Changeset f05edcb in mainline for uspace/srv/net/inetsrv
- Timestamp:
- 2021-08-08T08:28:24Z (5 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d5ed54b
- Parents:
- 98a935e
- Location:
- uspace/srv/net/inetsrv
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/addrobj.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 239 239 * Translate local destination IPv6 address. 240 240 */ 241 rc = ndp_translate(lsrc_v6, ldest_v6, ldest_mac, addr->ilink);241 rc = ndp_translate(lsrc_v6, ldest_v6, &ldest_mac, addr->ilink); 242 242 if (rc != EOK) 243 243 return rc; 244 244 245 return inet_link_send_dgram6(addr->ilink, ldest_mac, dgram,245 return inet_link_send_dgram6(addr->ilink, &ldest_mac, dgram, 246 246 proto, ttl, df); 247 247 default: -
uspace/srv/net/inetsrv/inet_link.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 56 56 57 57 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 );58 static errno_t inet_iplink_change_addr(iplink_t *, addr48_t *); 59 59 static inet_link_t *inet_link_get_by_id_locked(sysarg_t); 60 60 … … 70 70 { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0, 0, 0 }; 71 71 72 static void inet_link_local_node_ip(addr48_t mac_addr,72 static void inet_link_local_node_ip(addr48_t *mac_addr, 73 73 addr128_t ip_addr) 74 74 { 75 75 memcpy(ip_addr, link_local_node_ip, 16); 76 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];77 ip_addr[8] = mac_addr->b[0] ^ 0x02; 78 ip_addr[9] = mac_addr->b[1]; 79 ip_addr[10] = mac_addr->b[2]; 80 ip_addr[13] = mac_addr->b[3]; 81 ip_addr[14] = mac_addr->b[4]; 82 ip_addr[15] = mac_addr->b[5]; 83 83 } 84 84 … … 121 121 } 122 122 123 static errno_t inet_iplink_change_addr(iplink_t *iplink, addr48_t mac)123 static errno_t inet_iplink_change_addr(iplink_t *iplink, addr48_t *mac) 124 124 { 125 125 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_change_addr(): " 126 126 "new addr=%02x:%02x:%02x:%02x:%02x:%02x", 127 mac [0], mac[1], mac[2], mac[3], mac[4], mac[5]);127 mac->b[0], mac->b[1], mac->b[2], mac->b[3], mac->b[4], mac->b[5]); 128 128 129 129 list_foreach(inet_links, link_list, inet_link_t, ilink) { … … 261 261 262 262 addr128_t link_local; 263 inet_link_local_node_ip( ilink->mac, link_local);263 inet_link_local_node_ip(&ilink->mac, link_local); 264 264 265 265 inet_naddr_set6(link_local, 64, &addr6->naddr); … … 387 387 * 388 388 */ 389 errno_t inet_link_send_dgram6(inet_link_t *ilink, addr48_t ldest,389 errno_t inet_link_send_dgram6(inet_link_t *ilink, addr48_t *ldest, 390 390 inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df) 391 391 { … … 401 401 402 402 iplink_sdu6_t sdu6; 403 addr48(ldest, sdu6.dest);403 addr48(ldest, &sdu6.dest); 404 404 405 405 /* -
uspace/srv/net/inetsrv/inet_link.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 45 45 extern errno_t inet_link_send_dgram(inet_link_t *, addr32_t, 46 46 addr32_t, inet_dgram_t *, uint8_t, uint8_t, int); 47 extern errno_t inet_link_send_dgram6(inet_link_t *, addr48_t , inet_dgram_t *,47 extern errno_t inet_link_send_dgram6(inet_link_t *, addr48_t *, inet_dgram_t *, 48 48 uint8_t, uint8_t, int); 49 49 extern inet_link_t *inet_link_get_by_id(sysarg_t); -
uspace/srv/net/inetsrv/inetcfg.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 177 177 linfo->def_mtu = ilink->def_mtu; 178 178 if (ilink->mac_valid) { 179 addr48( ilink->mac,linfo->mac_addr);179 addr48(&ilink->mac, &linfo->mac_addr); 180 180 } else { 181 memset( linfo->mac_addr, 0, sizeof(linfo->mac_addr));181 memset(&linfo->mac_addr, 0, sizeof(linfo->mac_addr)); 182 182 } 183 183 -
uspace/srv/net/inetsrv/ndp.c
r98a935e rf05edcb 69 69 ndp_pdu_encode(packet, &dgram); 70 70 71 inet_link_send_dgram6(link, packet->target_hw_addr, &dgram,71 inet_link_send_dgram6(link, &packet->target_hw_addr, &dgram, 72 72 IP_PROTO_ICMPV6, INET6_HOP_LIMIT_MAX, 0); 73 73 … … 108 108 if (laddr != NULL) { 109 109 rc = ntrans_add(packet.sender_proto_addr, 110 packet.sender_hw_addr);110 &packet.sender_hw_addr); 111 111 if (rc != EOK) 112 112 return rc; … … 115 115 116 116 reply.opcode = ICMPV6_NEIGHBOUR_ADVERTISEMENT; 117 addr48( laddr->ilink->mac,reply.sender_hw_addr);117 addr48(&laddr->ilink->mac, &reply.sender_hw_addr); 118 118 addr128(packet.target_proto_addr, reply.sender_proto_addr); 119 addr48( packet.sender_hw_addr,reply.target_hw_addr);119 addr48(&packet.sender_hw_addr, &reply.target_hw_addr); 120 120 addr128(packet.sender_proto_addr, reply.target_proto_addr); 121 121 … … 128 128 if (laddr != NULL) 129 129 return ntrans_add(packet.sender_proto_addr, 130 packet.sender_hw_addr);130 &packet.sender_hw_addr); 131 131 132 132 break; … … 151 151 * 152 152 */ 153 errno_t ndp_translate(addr128_t src_addr, addr128_t ip_addr, addr48_t mac_addr,153 errno_t ndp_translate(addr128_t src_addr, addr128_t ip_addr, addr48_t *mac_addr, 154 154 inet_link_t *ilink) 155 155 { … … 167 167 168 168 packet.opcode = ICMPV6_NEIGHBOUR_SOLICITATION; 169 addr48( ilink->mac,packet.sender_hw_addr);169 addr48(&ilink->mac, &packet.sender_hw_addr); 170 170 addr128(src_addr, packet.sender_proto_addr); 171 171 addr128(ip_addr, packet.solicited_ip); 172 addr48_solicited_node(ip_addr, packet.target_hw_addr);172 addr48_solicited_node(ip_addr, &packet.target_hw_addr); 173 173 ndp_solicited_node_ip(ip_addr, packet.target_proto_addr); 174 174 -
uspace/srv/net/inetsrv/ndp.h
r98a935e rf05edcb 64 64 65 65 extern errno_t ndp_received(inet_dgram_t *); 66 extern errno_t ndp_translate(addr128_t, addr128_t, addr48_t , inet_link_t *);66 extern errno_t ndp_translate(addr128_t, addr128_t, addr48_t *, inet_link_t *); 67 67 68 68 #endif -
uspace/srv/net/inetsrv/ntrans.c
r98a935e rf05edcb 73 73 * 74 74 */ 75 errno_t ntrans_add(addr128_t ip_addr, addr48_t mac_addr)75 errno_t ntrans_add(addr128_t ip_addr, addr48_t *mac_addr) 76 76 { 77 77 inet_ntrans_t *ntrans; … … 83 83 84 84 addr128(ip_addr, ntrans->ip_addr); 85 addr48(mac_addr, ntrans->mac_addr);85 addr48(mac_addr, &ntrans->mac_addr); 86 86 87 87 fibril_mutex_lock(&ntrans_list_lock); … … 134 134 * 135 135 */ 136 errno_t ntrans_lookup(addr128_t ip_addr, addr48_t mac_addr)136 errno_t ntrans_lookup(addr128_t ip_addr, addr48_t *mac_addr) 137 137 { 138 138 fibril_mutex_lock(&ntrans_list_lock); … … 144 144 145 145 fibril_mutex_unlock(&ntrans_list_lock); 146 addr48( ntrans->mac_addr, mac_addr);146 addr48(&ntrans->mac_addr, mac_addr); 147 147 return EOK; 148 148 } -
uspace/srv/net/inetsrv/ntrans.h
r98a935e rf05edcb 48 48 } inet_ntrans_t; 49 49 50 extern errno_t ntrans_add(addr128_t, addr48_t );50 extern errno_t ntrans_add(addr128_t, addr48_t *); 51 51 extern errno_t ntrans_remove(addr128_t); 52 extern errno_t ntrans_lookup(addr128_t, addr48_t );52 extern errno_t ntrans_lookup(addr128_t, addr48_t *); 53 53 extern errno_t ntrans_wait_timeout(usec_t); 54 54 -
uspace/srv/net/inetsrv/pdu.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 40 40 #include <errno.h> 41 41 #include <fibril_synch.h> 42 #include <inet/eth_addr.h> 42 43 #include <io/log.h> 43 44 #include <macros.h> … … 504 505 505 506 message->length = 1; 506 addr48(ndp->sender_hw_addr, message->mac);507 mac48_encode(&ndp->sender_hw_addr, message->mac); 507 508 508 509 icmpv6_phdr_t phdr; … … 552 553 553 554 addr128_t_be2host(message->target_address, ndp->target_proto_addr); 554 addr48(message->mac,ndp->sender_hw_addr);555 mac48_decode(message->mac, &ndp->sender_hw_addr); 555 556 556 557 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.
