Changeset 19a4f73 in mainline for uspace/srv/net/udp/sock.c
- Timestamp:
- 2013-06-20T15:21:48Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2e3ee6
- Parents:
- 3e66428
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/sock.c
r3e66428 r19a4f73 199 199 } 200 200 201 socket = (udp_sockdata_t *)sock_core->specific_data; 202 203 fsock.addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr); 201 socket = (udp_sockdata_t *) sock_core->specific_data; 202 203 inet2_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr), 204 &fsock.addr); 204 205 fsock.port = sock_core->port; 205 206 urc = udp_uc_set_local(socket->assoc, &fsock); … … 269 270 } 270 271 271 fsock.addr.ipv4 = uint32_t_be2host(addr->sin_addr.s_addr); 272 inet2_addr_unpack(uint32_t_be2host(addr->sin_addr.s_addr), 273 &fsock.addr); 272 274 fsock.port = uint16_t_be2host(addr->sin_port); 273 275 fsock_ptr = &fsock; … … 314 316 fibril_mutex_lock(&socket->lock); 315 317 316 if ( socket->assoc->ident.local.addr.ipv4 == UDP_IPV4_ANY) {318 if (inet2_addr_is_any(&socket->assoc->ident.local.addr)) { 317 319 /* Determine local IP address */ 318 inet_addr_t loc_addr, rem_addr; 319 320 rem_addr.ipv4 = fsock_ptr ? fsock.addr.ipv4 : 321 socket->assoc->ident.foreign.addr.ipv4; 322 323 int rc = inet_get_srcaddr(&rem_addr, 0, &loc_addr); 320 inet2_addr_t loc_addr; 321 inet2_addr_t rem_addr; 322 323 rem_addr = fsock_ptr ? fsock.addr : 324 socket->assoc->ident.foreign.addr; 325 326 int rc = inet2_get_srcaddr(&rem_addr, 0, &loc_addr); 324 327 if (rc != EOK) { 325 328 fibril_mutex_unlock(&socket->lock); … … 330 333 } 331 334 332 socket->assoc->ident.local.addr.ipv4 = loc_addr.ipv4; 333 log_msg(LOG_DEFAULT, LVL_DEBUG, "Local IP address is %x", 334 socket->assoc->ident.local.addr.ipv4); 335 socket->assoc->ident.local.addr = loc_addr; 335 336 } 336 337 … … 410 411 size_t data_len; 411 412 udp_error_t urc; 412 udp_sock_t rsock;413 udp_sock_t *rsock; 413 414 struct sockaddr_in addr; 414 415 int rc; … … 446 447 log_msg(LOG_DEFAULT, LVL_DEBUG, "Got data in sock recv_buffer"); 447 448 448 rsock = socket->recv_fsock;449 rsock = &socket->recv_fsock; 449 450 data_len = socket->recv_buffer_used; 450 451 urc = socket->recv_error; … … 476 477 477 478 if (IPC_GET_IMETHOD(call) == NET_SOCKET_RECVFROM) { 478 /* Fill addr */ 479 /* Fill address */ 480 uint32_t rsock_addr; 481 int rc = inet2_addr_pack(&rsock->addr, &rsock_addr); 482 if (rc != EOK) { 483 fibril_mutex_unlock(&socket->recv_buffer_lock); 484 fibril_mutex_unlock(&socket->lock); 485 async_answer_0(callid, rc); 486 return; 487 } 488 479 489 addr.sin_family = AF_INET; 480 addr.sin_addr.s_addr = host2uint32_t_be(rsock .addr.ipv4);481 addr.sin_port = host2uint16_t_be(rsock .port);490 addr.sin_addr.s_addr = host2uint32_t_be(rsock_addr); 491 addr.sin_port = host2uint16_t_be(rsock->port); 482 492 483 493 log_msg(LOG_DEFAULT, LVL_DEBUG, "addr read receive");
Note:
See TracChangeset
for help on using the changeset viewer.