Changes in uspace/srv/net/inetsrv/inetsrv.c [b323a3a:9749e47] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/inetsrv.c
rb323a3a r9749e47 46 46 #include <stdlib.h> 47 47 #include <sys/types.h> 48 #include <net/socket_codes.h>49 48 #include "addrobj.h" 50 49 #include "icmp.h" … … 55 54 #include "inetcfg.h" 56 55 #include "inetping.h" 57 #include "inetping6.h"58 56 #include "inet_link.h" 59 57 #include "reass.h" … … 63 61 64 62 static inet_naddr_t solicited_node_mask = { 65 . family = AF_INET6,63 .version = ip_v6, 66 64 .addr6 = {0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0xff, 0, 0, 0}, 67 65 .prefix = 104 68 66 }; 69 67 68 static inet_addr_t broadcast4_all_hosts = { 69 .version = ip_v4, 70 .addr = 0xffffffff 71 }; 72 70 73 static inet_addr_t multicast_all_nodes = { 71 . family = AF_INET6,74 .version = ip_v6, 72 75 .addr6 = {0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01} 73 76 }; … … 111 114 return EEXIST; 112 115 } 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;135 116 136 117 return EOK; … … 186 167 { 187 168 inet_dir_t dir; 169 inet_link_t *ilink; 188 170 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 */ 189 192 190 193 rc = inet_find_dir(&dgram->src, &dgram->dest, dgram->tos, &dir); … … 214 217 215 218 /* 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 216 226 inet_naddr_addr(&dir.aobj->naddr, local); 217 227 return EOK; … … 282 292 inet_dgram_t dgram; 283 293 284 dgram.tos = IPC_GET_ARG1(*icall); 285 286 uint8_t ttl = IPC_GET_ARG2(*icall); 294 dgram.iplink = IPC_GET_ARG1(*icall); 295 dgram.tos = IPC_GET_ARG2(*icall); 296 297 uint8_t ttl = IPC_GET_ARG3(*icall); 287 298 int df = IPC_GET_ARG3(*icall); 288 299 … … 433 444 inetping_conn(iid, icall, arg); 434 445 break; 435 case INET_PORT_PING6:436 inetping6_conn(iid, icall, arg);437 break;438 446 default: 439 447 async_answer_0(iid, ENOTSUP); … … 446 454 fibril_mutex_lock(&client_list_lock); 447 455 448 list_foreach(client_list, link) { 449 inet_client_t *client = list_get_instance(link, inet_client_t, 450 client_list); 451 456 list_foreach(client_list, client_list, inet_client_t, client) { 452 457 if (client->protocol == proto) { 453 458 fibril_mutex_unlock(&client_list_lock); … … 527 532 if ((addr != NULL) || 528 533 (inet_naddr_compare_mask(&solicited_node_mask, &packet->dest)) || 529 (inet_addr_compare(&multicast_all_nodes, &packet->dest))) { 534 (inet_addr_compare(&multicast_all_nodes, &packet->dest)) || 535 (inet_addr_compare(&broadcast4_all_hosts, &packet->dest))) { 530 536 /* Destined for one of the local addresses */ 531 537
Note:
See TracChangeset
for help on using the changeset viewer.