Changes in uspace/srv/net/inetsrv/addrobj.c [30c5d13:5a324d99] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/addrobj.c
r30c5d13 r5a324d99 42 42 #include <stdlib.h> 43 43 #include <str.h> 44 #include <net/socket_codes.h>45 44 #include "addrobj.h" 46 45 #include "inetsrv.h" … … 115 114 fibril_mutex_lock(&addr_list_lock); 116 115 117 list_foreach(addr_list, link) { 118 inet_addrobj_t *naddr = list_get_instance(link, 119 inet_addrobj_t, addr_list); 120 116 list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) { 121 117 switch (find) { 122 118 case iaf_net: … … 158 154 name, ilink->svc_name); 159 155 160 list_foreach(addr_list, link) { 161 inet_addrobj_t *naddr = list_get_instance(link, 162 inet_addrobj_t, addr_list); 163 156 list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) { 164 157 if (naddr->ilink == ilink && str_cmp(naddr->name, name) == 0) { 165 158 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find_by_name_locked: found %p", … … 206 199 fibril_mutex_lock(&addr_list_lock); 207 200 208 list_foreach(addr_list, link) { 209 inet_addrobj_t *naddr = list_get_instance(link, 210 inet_addrobj_t, addr_list); 211 201 list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) { 212 202 if (naddr->id == id) { 213 203 fibril_mutex_unlock(&addr_list_lock); … … 227 217 inet_addr_t lsrc_addr; 228 218 inet_naddr_addr(&addr->naddr, &lsrc_addr); 229 219 230 220 addr32_t lsrc_v4; 231 221 addr128_t lsrc_v6; 232 uint16_t lsrc_af= inet_addr_get(&lsrc_addr, &lsrc_v4, &lsrc_v6);233 222 ip_ver_t lsrc_ver = inet_addr_get(&lsrc_addr, &lsrc_v4, &lsrc_v6); 223 234 224 addr32_t ldest_v4; 235 225 addr128_t ldest_v6; 236 uint16_t ldest_af= inet_addr_get(ldest, &ldest_v4, &ldest_v6);237 238 if (lsrc_ af != ldest_af)226 ip_ver_t ldest_ver = inet_addr_get(ldest, &ldest_v4, &ldest_v6); 227 228 if (lsrc_ver != ldest_ver) 239 229 return EINVAL; 240 230 241 231 int rc; 242 232 addr48_t ldest_mac; 243 244 switch (ldest_ af) {245 case AF_INET:233 234 switch (ldest_ver) { 235 case ip_v4: 246 236 return inet_link_send_dgram(addr->ilink, lsrc_v4, ldest_v4, 247 237 dgram, proto, ttl, df); 248 case AF_INET6:238 case ip_v6: 249 239 /* 250 240 * Translate local destination IPv6 address. … … 253 243 if (rc != EOK) 254 244 return rc; 255 245 256 246 return inet_link_send_dgram6(addr->ilink, ldest_mac, dgram, 257 247 proto, ttl, df); 258 } 259 248 default: 249 assert(false); 250 break; 251 } 252 260 253 return ENOTSUP; 261 254 } … … 277 270 278 271 i = 0; 279 list_foreach(addr_list, link) { 280 inet_addrobj_t *addr = list_get_instance(link, 281 inet_addrobj_t, addr_list); 282 272 list_foreach(addr_list, addr_list, inet_addrobj_t, addr) { 283 273 id_list[i++] = addr->id; 284 274 }
Note:
See TracChangeset
for help on using the changeset viewer.