Changeset 8a9a41e in mainline for uspace/srv/net/inetsrv/inet_link.c
- Timestamp:
- 2021-10-24T08:28:43Z (4 years ago)
- Children:
- 9ea3a41
- Parents:
- 2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
- git-committer:
- GitHub <noreply@…> (2021-10-24 08:28:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inet_link.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 35 35 */ 36 36 37 #include <stdbool.h>38 37 #include <errno.h> 39 #include <str_error.h>40 38 #include <fibril_synch.h> 39 #include <inet/eth_addr.h> 41 40 #include <inet/iplink.h> 42 41 #include <io/log.h> 43 42 #include <loc.h> 43 #include <stdbool.h> 44 44 #include <stdlib.h> 45 45 #include <str.h> 46 #include <str_error.h> 46 47 #include "addrobj.h" 47 48 #include "inetsrv.h" … … 56 57 57 58 static errno_t inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t); 58 static errno_t inet_iplink_change_addr(iplink_t *, addr48_t);59 static errno_t inet_iplink_change_addr(iplink_t *, eth_addr_t *); 59 60 static inet_link_t *inet_link_get_by_id_locked(sysarg_t); 60 61 … … 70 71 { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0, 0, 0 }; 71 72 72 static void inet_link_local_node_ip( addr48_tmac_addr,73 static void inet_link_local_node_ip(eth_addr_t *mac_addr, 73 74 addr128_t ip_addr) 74 75 { 76 uint8_t b[ETH_ADDR_SIZE]; 77 75 78 memcpy(ip_addr, link_local_node_ip, 16); 76 77 ip_addr[8] = mac_addr[0] ^ 0x02; 78 ip_addr[9] = mac_addr[1]; 79 ip_addr[10] = mac_addr[2]; 80 ip_addr[13] = mac_addr[3]; 81 ip_addr[14] = mac_addr[4]; 82 ip_addr[15] = mac_addr[5]; 79 eth_addr_encode(mac_addr, b); 80 81 ip_addr[8] = b[0] ^ 0x02; 82 ip_addr[9] = b[1]; 83 ip_addr[10] = b[2]; 84 ip_addr[13] = b[3]; 85 ip_addr[14] = b[4]; 86 ip_addr[15] = b[5]; 83 87 } 84 88 … … 121 125 } 122 126 123 static errno_t inet_iplink_change_addr(iplink_t *iplink, addr48_t mac) 124 { 127 static errno_t inet_iplink_change_addr(iplink_t *iplink, eth_addr_t *mac) 128 { 129 eth_addr_str_t saddr; 130 131 eth_addr_format(mac, &saddr); 125 132 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_change_addr(): " 126 "new addr=%02x:%02x:%02x:%02x:%02x:%02x", 127 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 133 "new addr=%s", saddr.str); 128 134 129 135 list_foreach(inet_links, link_list, inet_link_t, ilink) { 130 136 if (ilink->sess == iplink->sess) 131 memcpy(&ilink->mac, mac, sizeof(addr48_t));137 ilink->mac = *mac; 132 138 } 133 139 … … 261 267 262 268 addr128_t link_local; 263 inet_link_local_node_ip( ilink->mac, link_local);269 inet_link_local_node_ip(&ilink->mac, link_local); 264 270 265 271 inet_naddr_set6(link_local, 64, &addr6->naddr); … … 387 393 * 388 394 */ 389 errno_t inet_link_send_dgram6(inet_link_t *ilink, addr48_tldest,395 errno_t inet_link_send_dgram6(inet_link_t *ilink, eth_addr_t *ldest, 390 396 inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df) 391 397 { … … 401 407 402 408 iplink_sdu6_t sdu6; 403 addr48(ldest, sdu6.dest);409 sdu6.dest = *ldest; 404 410 405 411 /*
Note:
See TracChangeset
for help on using the changeset viewer.