Changeset f05edcb in mainline
- Timestamp:
- 2021-08-08T08:28:24Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d5ed54b
- Parents:
- 98a935e
- Location:
- uspace
- Files:
-
- 2 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/inet/inet.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 370 370 table_printf(table, "%02x:%02x:%02x:%02x:%02x:%02x\t" 371 371 "%s\t" "%zu\n", 372 linfo.mac_addr [0], linfo.mac_addr[1],373 linfo.mac_addr [2], linfo.mac_addr[3],374 linfo.mac_addr [4], linfo.mac_addr[5],372 linfo.mac_addr.b[0], linfo.mac_addr.b[1], 373 linfo.mac_addr.b[2], linfo.mac_addr.b[3], 374 linfo.mac_addr.b[4], linfo.mac_addr.b[5], 375 375 linfo.name, linfo.def_mtu); 376 376 -
uspace/lib/drv/generic/remote_ieee80211.c
r98a935e rf05edcb 109 109 return -1; 110 110 111 if (mac_matches(mac, link_info.mac_addr ))111 if (mac_matches(mac, link_info.mac_addr.b)) 112 112 return link_list[i]; 113 113 } … … 229 229 return rc; 230 230 231 if (mac_matches(wifi_mac.address, link_info.mac_addr )) {231 if (mac_matches(wifi_mac.address, link_info.mac_addr.b)) { 232 232 if (str_test_prefix(addr_info.name, "dhcp")) { 233 233 rc = inetcfg_addr_delete(addr_list[i]); -
uspace/lib/inet/include/inet/addr.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 40 40 41 41 typedef uint32_t addr32_t; 42 typedef uint8_t addr48_t[6]; 42 43 #define ETH_ADDR_SIZE 6 44 45 typedef struct { 46 uint8_t b[ETH_ADDR_SIZE]; 47 } addr48_t; 48 43 49 typedef uint8_t addr128_t[16]; 44 50 … … 80 86 extern const addr48_t addr48_broadcast; 81 87 82 extern void addr48(const addr48_t , addr48_t);88 extern void addr48(const addr48_t *, addr48_t *); 83 89 extern void addr128(const addr128_t, addr128_t); 84 90 85 extern int addr48_compare(const addr48_t , const addr48_t);91 extern int addr48_compare(const addr48_t *, const addr48_t *); 86 92 extern int addr128_compare(const addr128_t, const addr128_t); 87 93 88 extern void addr48_solicited_node(const addr128_t, addr48_t );94 extern void addr48_solicited_node(const addr128_t, addr48_t *); 89 95 90 96 extern void host2addr128_t_be(const addr128_t, addr128_t); -
uspace/lib/inet/include/inet/iplink.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 79 79 typedef struct iplink_ev_ops { 80 80 errno_t (*recv)(iplink_t *, iplink_recv_sdu_t *, ip_ver_t); 81 errno_t (*change_addr)(iplink_t *, addr48_t );81 errno_t (*change_addr)(iplink_t *, addr48_t *); 82 82 } iplink_ev_ops_t; 83 83 … … 90 90 extern errno_t iplink_get_mtu(iplink_t *, size_t *); 91 91 extern errno_t iplink_get_mac48(iplink_t *, addr48_t *); 92 extern errno_t iplink_set_mac48(iplink_t *, addr48_t );92 extern errno_t iplink_set_mac48(iplink_t *, addr48_t *); 93 93 extern void *iplink_get_userptr(iplink_t *); 94 94 -
uspace/lib/inet/meson.build
r98a935e rf05edcb 32 32 'src/dnsr.c', 33 33 'src/endpoint.c', 34 'src/eth_addr.c', 34 35 'src/host.c', 35 36 'src/hostname.c', -
uspace/lib/inet/src/addr.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * Copyright (c) 2013 Martin Decky 4 4 * All rights reserved. … … 72 72 }; 73 73 74 void addr48(const addr48_t src, addr48_tdst)75 { 76 memcpy(dst, src, 6);74 void addr48(const addr48_t *src, addr48_t *dst) 75 { 76 memcpy(dst, src, sizeof(addr48_t)); 77 77 } 78 78 … … 86 86 * @return Non-zero if equal, zero if not equal. 87 87 */ 88 int addr48_compare(const addr48_t a, const addr48_tb)89 { 90 return memcmp(a ,b, 6) == 0;88 int addr48_compare(const addr48_t *a, const addr48_t *b) 89 { 90 return memcmp(a->b, b->b, 6) == 0; 91 91 } 92 92 … … 106 106 * 107 107 */ 108 void addr48_solicited_node(const addr128_t ip, addr48_t mac)109 { 110 memcpy( mac, inet_addr48_solicited_node, 3);111 memcpy( mac + 3, ip + 13, 3);108 void addr48_solicited_node(const addr128_t ip, addr48_t *mac) 109 { 110 memcpy(&mac->b[0], &inet_addr48_solicited_node.b[0], 3); 111 memcpy(&mac->b[3], ip + 13, 3); 112 112 } 113 113 -
uspace/lib/inet/src/iplink.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 175 175 } 176 176 177 errno_t iplink_set_mac48(iplink_t *iplink, addr48_t mac)177 errno_t iplink_set_mac48(iplink_t *iplink, addr48_t *mac) 178 178 { 179 179 async_exch_t *exch = async_exchange_begin(iplink->sess); … … 274 274 } 275 275 276 rc = iplink->ev_ops->change_addr(iplink, *addr);276 rc = iplink->ev_ops->change_addr(iplink, addr); 277 277 free(addr); 278 278 async_answer_0(icall, EOK); -
uspace/srv/net/dhcp/dhcp.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 161 161 hdr->flags = flag_broadcast; 162 162 163 addr48(dlink->link_info.mac_addr, hdr->chaddr); 163 memcpy(dlink->link_info.mac_addr.b, hdr->chaddr, 164 sizeof(dlink->link_info.mac_addr.b)); 164 165 hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic); 165 166 … … 185 186 hdr->flags = flag_broadcast; 186 187 hdr->ciaddr = host2uint32_t_be(offer->oaddr.addr); 187 addr48(dlink->link_info.mac_addr, hdr->chaddr);188 memcpy(hdr->chaddr, dlink->link_info.mac_addr.b, 6); 188 189 hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic); 189 190 -
uspace/srv/net/ethip/arp.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 79 79 80 80 (void) atrans_add(packet.sender_proto_addr, 81 packet.sender_hw_addr);81 &packet.sender_hw_addr); 82 82 83 83 if (packet.opcode == aop_request) { … … 85 85 86 86 reply.opcode = aop_reply; 87 addr48( nic->mac_addr,reply.sender_hw_addr);87 addr48(&nic->mac_addr, &reply.sender_hw_addr); 88 88 reply.sender_proto_addr = laddr_v4; 89 addr48( packet.sender_hw_addr,reply.target_hw_addr);89 addr48(&packet.sender_hw_addr, &reply.target_hw_addr); 90 90 reply.target_proto_addr = packet.sender_proto_addr; 91 91 … … 95 95 96 96 errno_t arp_translate(ethip_nic_t *nic, addr32_t src_addr, addr32_t ip_addr, 97 addr48_t mac_addr)97 addr48_t *mac_addr) 98 98 { 99 99 /* Broadcast address */ 100 100 if (ip_addr == addr32_broadcast_all_hosts) { 101 addr48( addr48_broadcast, mac_addr);101 addr48(&addr48_broadcast, mac_addr); 102 102 return EOK; 103 103 } … … 110 110 111 111 packet.opcode = aop_request; 112 addr48( nic->mac_addr,packet.sender_hw_addr);112 addr48(&nic->mac_addr, &packet.sender_hw_addr); 113 113 packet.sender_proto_addr = src_addr; 114 addr48( addr48_broadcast,packet.target_hw_addr);114 addr48(&addr48_broadcast, &packet.target_hw_addr); 115 115 packet.target_proto_addr = ip_addr; 116 116 … … 138 138 return rc; 139 139 140 addr48( packet->target_hw_addr,frame.dest);141 addr48( packet->sender_hw_addr,frame.src);140 addr48(&packet->target_hw_addr, &frame.dest); 141 addr48(&packet->sender_hw_addr, &frame.src); 142 142 frame.etype_len = ETYPE_ARP; 143 143 frame.data = pdata; -
uspace/srv/net/ethip/arp.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 44 44 extern void arp_received(ethip_nic_t *, eth_frame_t *); 45 extern errno_t arp_translate(ethip_nic_t *, addr32_t, addr32_t, addr48_t );45 extern errno_t arp_translate(ethip_nic_t *, addr32_t, addr32_t, addr48_t *); 46 46 47 47 #endif -
uspace/srv/net/ethip/atrans.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 59 59 } 60 60 61 errno_t atrans_add(addr32_t ip_addr, addr48_t mac_addr)61 errno_t atrans_add(addr32_t ip_addr, addr48_t *mac_addr) 62 62 { 63 63 ethip_atrans_t *atrans; … … 69 69 70 70 atrans->ip_addr = ip_addr; 71 addr48(mac_addr, atrans->mac_addr);71 addr48(mac_addr, &atrans->mac_addr); 72 72 73 73 fibril_mutex_lock(&atrans_list_lock); … … 103 103 } 104 104 105 static errno_t atrans_lookup_locked(addr32_t ip_addr, addr48_t mac_addr)105 static errno_t atrans_lookup_locked(addr32_t ip_addr, addr48_t *mac_addr) 106 106 { 107 107 ethip_atrans_t *atrans = atrans_find(ip_addr); … … 109 109 return ENOENT; 110 110 111 addr48( atrans->mac_addr, mac_addr);111 addr48(&atrans->mac_addr, mac_addr); 112 112 return EOK; 113 113 } 114 114 115 errno_t atrans_lookup(addr32_t ip_addr, addr48_t mac_addr)115 errno_t atrans_lookup(addr32_t ip_addr, addr48_t *mac_addr) 116 116 { 117 117 errno_t rc; … … 135 135 136 136 errno_t atrans_lookup_timeout(addr32_t ip_addr, usec_t timeout, 137 addr48_t mac_addr)137 addr48_t *mac_addr) 138 138 { 139 139 fibril_timer_t *t; -
uspace/srv/net/ethip/atrans.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 42 42 #include "ethip.h" 43 43 44 extern errno_t atrans_add(addr32_t, addr48_t );44 extern errno_t atrans_add(addr32_t, addr48_t *); 45 45 extern errno_t atrans_remove(addr32_t); 46 extern errno_t atrans_lookup(addr32_t, addr48_t );47 extern errno_t atrans_lookup_timeout(addr32_t, usec_t, addr48_t );46 extern errno_t atrans_lookup(addr32_t, addr48_t *); 47 extern errno_t atrans_lookup_timeout(addr32_t, usec_t, addr48_t *); 48 48 49 49 #endif -
uspace/srv/net/ethip/ethip.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 177 177 eth_frame_t frame; 178 178 179 errno_t rc = arp_translate(nic, sdu->src, sdu->dest, frame.dest);179 errno_t rc = arp_translate(nic, sdu->src, sdu->dest, &frame.dest); 180 180 if (rc != EOK) { 181 181 log_msg(LOG_DEFAULT, LVL_WARN, "Failed to look up IPv4 address 0x%" … … 184 184 } 185 185 186 addr48( nic->mac_addr,frame.src);186 addr48(&nic->mac_addr, &frame.src); 187 187 frame.etype_len = ETYPE_IP; 188 188 frame.data = sdu->data; … … 208 208 eth_frame_t frame; 209 209 210 addr48( sdu->dest,frame.dest);211 addr48( nic->mac_addr,frame.src);210 addr48(&sdu->dest, &frame.dest); 211 addr48(&nic->mac_addr, &frame.src); 212 212 frame.etype_len = ETYPE_IPV6; 213 213 frame.data = sdu->data; … … 281 281 282 282 ethip_nic_t *nic = (ethip_nic_t *) srv->arg; 283 addr48( nic->mac_addr, *mac);283 addr48(&nic->mac_addr, mac); 284 284 285 285 return EOK; … … 291 291 292 292 ethip_nic_t *nic = (ethip_nic_t *) srv->arg; 293 addr48( *mac,nic->mac_addr);293 addr48(mac, &nic->mac_addr); 294 294 295 295 return EOK; -
uspace/srv/net/ethip/ethip_nic.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 193 193 } 194 194 195 addr48(nic_address.address,nic->mac_addr);195 mac48_decode(nic_address.address, &nic->mac_addr); 196 196 197 197 rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE); … … 400 400 401 401 addr48_t mac; 402 addr48_solicited_node(v6, mac);402 addr48_solicited_node(v6, &mac); 403 403 404 404 /* Avoid duplicate addresses in the list */ … … 407 407 408 408 for (size_t j = 0; j < i; j++) { 409 if (addr48_compare(mac_list[j].address, mac)) { 409 addr48_t mac_entry; 410 mac48_decode(mac_list[j].address, &mac_entry); 411 if (addr48_compare(&mac_entry, &mac)) { 410 412 found = true; 411 413 break; … … 414 416 415 417 if (!found) { 416 addr48(mac, mac_list[i].address);418 mac48_encode(&mac, mac_list[i].address); 417 419 i++; 418 } else 420 } else { 419 421 count--; 422 } 420 423 } 421 424 -
uspace/srv/net/ethip/pdu.c
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 60 60 61 61 hdr = (eth_header_t *)data; 62 addr48(frame->src, hdr->src);63 addr48(frame->dest, hdr->dest);62 mac48_encode(&frame->src, hdr->src); 63 mac48_encode(&frame->dest, hdr->dest); 64 64 hdr->etype_len = host2uint16_t_be(frame->etype_len); 65 65 … … 93 93 return ENOMEM; 94 94 95 addr48(hdr->src,frame->src);96 addr48(hdr->dest,frame->dest);95 mac48_decode(hdr->src, &frame->src); 96 mac48_decode(hdr->dest, &frame->dest); 97 97 frame->etype_len = uint16_t_be2host(hdr->etype_len); 98 98 … … 140 140 pfmt->proto_addr_size = IPV4_ADDR_SIZE; 141 141 pfmt->opcode = host2uint16_t_be(fopcode); 142 addr48(packet->sender_hw_addr, pfmt->sender_hw_addr);142 mac48_encode(&packet->sender_hw_addr, pfmt->sender_hw_addr); 143 143 pfmt->sender_proto_addr = 144 144 host2uint32_t_be(packet->sender_proto_addr); 145 addr48(packet->target_hw_addr, pfmt->target_hw_addr);145 mac48_encode(&packet->target_hw_addr, pfmt->target_hw_addr); 146 146 pfmt->target_proto_addr = 147 147 host2uint32_t_be(packet->target_proto_addr); … … 203 203 } 204 204 205 addr48(pfmt->sender_hw_addr,packet->sender_hw_addr);205 mac48_decode(pfmt->sender_hw_addr, &packet->sender_hw_addr); 206 206 packet->sender_proto_addr = 207 207 uint32_t_be2host(pfmt->sender_proto_addr); 208 addr48(pfmt->target_hw_addr,packet->target_hw_addr);208 mac48_decode(pfmt->target_hw_addr, &packet->target_hw_addr); 209 209 packet->target_proto_addr = 210 210 uint32_t_be2host(pfmt->target_proto_addr); -
uspace/srv/net/ethip/pdu.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 44 44 extern errno_t arp_pdu_encode(arp_eth_packet_t *, void **, size_t *); 45 45 extern errno_t arp_pdu_decode(void *, size_t, arp_eth_packet_t *); 46 extern void mac48_encode(addr48_t *, void *); 47 extern void mac48_decode(void *, addr48_t *); 46 48 47 49 #endif -
uspace/srv/net/ethip/std.h
r98a935e rf05edcb 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 40 40 #include <stdint.h> 41 #include <inet/addr.h>42 41 43 42 #define ETH_ADDR_SIZE 6 … … 48 47 typedef struct { 49 48 /** Destination Address */ 50 addr48_t dest;49 uint8_t dest[ETH_ADDR_SIZE]; 51 50 /** Source Address */ 52 addr48_t src;51 uint8_t src[ETH_ADDR_SIZE]; 53 52 /** Ethertype or Length */ 54 53 uint16_t etype_len; … … 68 67 uint16_t opcode; 69 68 /** Sender hardware address */ 70 addr48_t sender_hw_addr;69 uint8_t sender_hw_addr[ETH_ADDR_SIZE]; 71 70 /** Sender protocol address */ 72 addr32_t sender_proto_addr;71 uint32_t sender_proto_addr; 73 72 /** Target hardware address */ 74 addr48_t target_hw_addr;73 uint8_t target_hw_addr[ETH_ADDR_SIZE]; 75 74 /** Target protocol address */ 76 addr32_t target_proto_addr;75 uint32_t target_proto_addr; 77 76 } __attribute__((packed)) arp_eth_packet_fmt_t; 78 77 -
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.