Changes in uspace/srv/net/inetsrv/addrobj.c [02a09ed:30c5d13] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/addrobj.c
r02a09ed r30c5d13 42 42 #include <stdlib.h> 43 43 #include <str.h> 44 #include <net/socket_codes.h> 44 45 #include "addrobj.h" 45 46 #include "inetsrv.h" 46 47 #include "inet_link.h" 48 #include "ndp.h" 47 49 48 50 static inet_addrobj_t *inet_addrobj_find_by_name_locked(const char *, inet_link_t *); … … 117 119 inet_addrobj_t, addr_list); 118 120 119 if (inet_naddr_compare_mask(&naddr->naddr, addr)) { 120 fibril_mutex_unlock(&addr_list_lock); 121 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p", 122 naddr); 123 return naddr; 121 switch (find) { 122 case iaf_net: 123 if (inet_naddr_compare_mask(&naddr->naddr, addr)) { 124 fibril_mutex_unlock(&addr_list_lock); 125 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p", 126 naddr); 127 return naddr; 128 } 129 break; 130 case iaf_addr: 131 if (inet_naddr_compare(&naddr->naddr, addr)) { 132 fibril_mutex_unlock(&addr_list_lock); 133 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p", 134 naddr); 135 return naddr; 136 } 137 break; 124 138 } 125 139 } … … 214 228 inet_naddr_addr(&addr->naddr, &lsrc_addr); 215 229 216 return inet_link_send_dgram(addr->ilink, &lsrc_addr, ldest, dgram, 217 proto, ttl, df); 230 addr32_t lsrc_v4; 231 addr128_t lsrc_v6; 232 uint16_t lsrc_af = inet_addr_get(&lsrc_addr, &lsrc_v4, &lsrc_v6); 233 234 addr32_t ldest_v4; 235 addr128_t ldest_v6; 236 uint16_t ldest_af = inet_addr_get(ldest, &ldest_v4, &ldest_v6); 237 238 if (lsrc_af != ldest_af) 239 return EINVAL; 240 241 int rc; 242 addr48_t ldest_mac; 243 244 switch (ldest_af) { 245 case AF_INET: 246 return inet_link_send_dgram(addr->ilink, lsrc_v4, ldest_v4, 247 dgram, proto, ttl, df); 248 case AF_INET6: 249 /* 250 * Translate local destination IPv6 address. 251 */ 252 rc = ndp_translate(lsrc_v6, ldest_v6, ldest_mac, addr->ilink); 253 if (rc != EOK) 254 return rc; 255 256 return inet_link_send_dgram6(addr->ilink, ldest_mac, dgram, 257 proto, ttl, df); 258 } 259 260 return ENOTSUP; 218 261 } 219 262
Note:
See TracChangeset
for help on using the changeset viewer.