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