Changeset 0ac2158 in mainline for uspace/srv/net/tl/tcp/ucall.c


Ignore:
Timestamp:
2011-12-08T23:29:06Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d9e14fa4
Parents:
5f9ecd3
Message:

Determine local IP address, fill it in pseudo header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/tcp/ucall.c

    r5f9ecd3 r0ac2158  
    5050/** OPEN user call
    5151 *
    52  * @param lport         Local port
     52 * @param lsock         Local socket
    5353 * @param fsock         Foreign socket
    5454 * @param acpass        Active/passive
    5555 * @param conn          Connection
     56 *
     57 * Unlike in the spec we allow specifying the local address. This means
     58 * the implementation does not need to magically guess it, especially
     59 * considering there can be more than one local address.
    5660 *
    5761 * XXX We should be able to call active open on an existing listening
     
    6064 * establishment.
    6165 */
    62 tcp_error_t tcp_uc_open(uint16_t lport, tcp_sock_t *fsock, acpass_t acpass,
     66tcp_error_t tcp_uc_open(tcp_sock_t *lsock, tcp_sock_t *fsock, acpass_t acpass,
    6367    tcp_conn_t **conn)
    6468{
    6569        tcp_conn_t *nconn;
    66         tcp_sock_t lsock;
    67 
    68         log_msg(LVL_DEBUG, "tcp_uc_open(%" PRIu16 ", %p, %s, %p)",
    69             lport, fsock, acpass == ap_active ? "active" : "passive",
     70
     71        log_msg(LVL_DEBUG, "tcp_uc_open(%p, %p, %s, %p)",
     72            lsock, fsock, acpass == ap_active ? "active" : "passive",
    7073            conn);
    7174
    72         lsock.port = lport;
    73         lsock.addr.ipv4 = TCP_IPV4_ANY;
    74 
    75         nconn = tcp_conn_new(&lsock, fsock);
     75        nconn = tcp_conn_new(lsock, fsock);
    7676        tcp_conn_add(nconn);
    7777
     
    246246                if (conn->ident.foreign.port == TCP_PORT_ANY)
    247247                        conn->ident.foreign.port = sp->foreign.port;
     248                if (conn->ident.local.addr.ipv4 == TCP_IPV4_ANY)
     249                        conn->ident.local.addr.ipv4 = sp->local.addr.ipv4;
    248250
    249251                tcp_conn_segment_arrived(conn, seg);
Note: See TracChangeset for help on using the changeset viewer.