Changes in uspace/srv/net/inetsrv/inetsrv.c [9749e47:b323a3a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inetsrv.c
r9749e47 rb323a3a 46 46 #include <stdlib.h> 47 47 #include <sys/types.h> 48 #include <net/socket_codes.h> 48 49 #include "addrobj.h" 49 50 #include "icmp.h" … … 54 55 #include "inetcfg.h" 55 56 #include "inetping.h" 57 #include "inetping6.h" 56 58 #include "inet_link.h" 57 59 #include "reass.h" … … 61 63 62 64 static inet_naddr_t solicited_node_mask = { 63 . version = ip_v6,65 .family = AF_INET6, 64 66 .addr6 = {0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0xff, 0, 0, 0}, 65 67 .prefix = 104 66 68 }; 67 69 68 static inet_addr_t broadcast4_all_hosts = {69 .version = ip_v4,70 .addr = 0xffffffff71 };72 73 70 static inet_addr_t multicast_all_nodes = { 74 . version = ip_v6,71 .family = AF_INET6, 75 72 .addr6 = {0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01} 76 73 }; … … 114 111 return EEXIST; 115 112 } 113 114 rc = loc_service_register_with_iface(SERVICE_NAME_INETPING6, &sid, 115 INET_PORT_PING6); 116 if (rc != EOK) { 117 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc); 118 return EEXIST; 119 } 120 121 inet_sroute_t *sroute = inet_sroute_new(); 122 if (sroute == NULL) { 123 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating default route (%d).", rc); 124 return ENOMEM; 125 } 126 127 inet_naddr(&sroute->dest, 0, 0, 0, 0, 0); 128 inet_addr(&sroute->router, 10, 0, 2, 2); 129 sroute->name = str_dup("default"); 130 inet_sroute_add(sroute); 131 132 rc = inet_link_discovery_start(); 133 if (rc != EOK) 134 return EEXIST; 116 135 117 136 return EOK; … … 167 186 { 168 187 inet_dir_t dir; 169 inet_link_t *ilink;170 188 int rc; 171 172 if (dgram->iplink != 0) {173 /* XXX TODO - IPv6 */174 log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram directly to iplink %zu",175 dgram->iplink);176 /* Send packet directly to the specified IP link */177 ilink = inet_link_get_by_id(dgram->iplink);178 if (ilink == 0)179 return ENOENT;180 181 if (dgram->src.version != ip_v4 ||182 dgram->dest.version != ip_v4)183 return EINVAL;184 185 return inet_link_send_dgram(ilink, dgram->src.addr,186 dgram->dest.addr, dgram, proto, ttl, df);187 }188 189 log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram to be routed");190 191 /* Route packet using source/destination addresses */192 189 193 190 rc = inet_find_dir(&dgram->src, &dgram->dest, dgram->tos, &dir); … … 217 214 218 215 /* Take source address from the address object */ 219 if (remote->version == ip_v4 && remote->addr == 0xffffffff) {220 /* XXX TODO - IPv6 */221 local->version = ip_v4;222 local->addr = 0;223 return EOK;224 }225 226 216 inet_naddr_addr(&dir.aobj->naddr, local); 227 217 return EOK; … … 292 282 inet_dgram_t dgram; 293 283 294 dgram.iplink = IPC_GET_ARG1(*icall); 295 dgram.tos = IPC_GET_ARG2(*icall); 296 297 uint8_t ttl = IPC_GET_ARG3(*icall); 284 dgram.tos = IPC_GET_ARG1(*icall); 285 286 uint8_t ttl = IPC_GET_ARG2(*icall); 298 287 int df = IPC_GET_ARG3(*icall); 299 288 … … 444 433 inetping_conn(iid, icall, arg); 445 434 break; 435 case INET_PORT_PING6: 436 inetping6_conn(iid, icall, arg); 437 break; 446 438 default: 447 439 async_answer_0(iid, ENOTSUP); … … 454 446 fibril_mutex_lock(&client_list_lock); 455 447 456 list_foreach(client_list, client_list, inet_client_t, client) { 448 list_foreach(client_list, link) { 449 inet_client_t *client = list_get_instance(link, inet_client_t, 450 client_list); 451 457 452 if (client->protocol == proto) { 458 453 fibril_mutex_unlock(&client_list_lock); … … 532 527 if ((addr != NULL) || 533 528 (inet_naddr_compare_mask(&solicited_node_mask, &packet->dest)) || 534 (inet_addr_compare(&multicast_all_nodes, &packet->dest)) || 535 (inet_addr_compare(&broadcast4_all_hosts, &packet->dest))) { 529 (inet_addr_compare(&multicast_all_nodes, &packet->dest))) { 536 530 /* Destined for one of the local addresses */ 537 531
Note:
See TracChangeset
for help on using the changeset viewer.