Changeset 695b6ff in mainline for uspace/srv/net/inetsrv
- Timestamp:
- 2013-09-12T21:26:18Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b8b1adb1, ddd0499d
- Parents:
- 4a90582
- Location:
- uspace/srv/net/inetsrv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/inetsrv/icmp.c
r4a90582 r695b6ff 105 105 reply->checksum = host2uint16_t_be(checksum); 106 106 107 rdgram.iplink = 0; 107 108 rdgram.src = dgram->dest; 108 109 rdgram.dest = dgram->src; … … 171 172 inet_addr_set(sdu->dest, &dgram.dest); 172 173 174 dgram.iplink = 0; 173 175 dgram.tos = ICMP_TOS; 174 176 dgram.data = rdata; -
uspace/srv/net/inetsrv/inet_link.c
r4a90582 r695b6ff 235 235 inet_addrobj_t *addr = NULL; 236 236 237 /* XXX FIXME Cannot rely on loopback being the first IP link service!! */ 237 238 if (first_link) { 238 239 addr = inet_addrobj_new(); … … 240 241 inet_naddr(&addr->naddr, 127, 0, 0, 1, 24); 241 242 first_link = false; 242 } else {243 /*244 * FIXME245 * Setting static IPv4 address for testing purposes:246 * 10.0.2.15/24247 */248 addr = inet_addrobj_new();249 250 inet_naddr(&addr->naddr, 10, 0, 2, 15, 24);251 243 } 252 244 -
uspace/srv/net/inetsrv/inetsrv.c
r4a90582 r695b6ff 68 68 }; 69 69 70 static inet_addr_t broadcast4_all_hosts = { 71 .family = AF_INET, 72 .addr = 0xffffffff 73 }; 74 70 75 static inet_addr_t multicast_all_nodes = { 71 76 .family = AF_INET6, … … 119 124 } 120 125 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 126 rc = inet_link_discovery_start(); 133 127 if (rc != EOK) … … 186 180 { 187 181 inet_dir_t dir; 182 inet_link_t *ilink; 188 183 int rc; 184 185 if (dgram->iplink != 0) { 186 log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram directly to iplink %zu", 187 dgram->iplink); 188 /* Send packet directly to the specified IP link */ 189 ilink = inet_link_get_by_id(dgram->iplink); 190 if (ilink == 0) 191 return ENOENT; 192 193 if (dgram->src.family != AF_INET || 194 dgram->dest.family != AF_INET) 195 return EINVAL; 196 197 return inet_link_send_dgram(ilink, dgram->src.addr, 198 dgram->dest.addr, dgram, proto, ttl, df); 199 } 200 201 log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram to be routed"); 202 203 /* Route packet using source/destination addresses */ 189 204 190 205 rc = inet_find_dir(&dgram->src, &dgram->dest, dgram->tos, &dir); … … 214 229 215 230 /* Take source address from the address object */ 231 if (remote->family == AF_INET && remote->addr == 0xffffffff) { 232 local->family = AF_INET; 233 local->addr = 0; 234 return EOK; 235 } 216 236 inet_naddr_addr(&dir.aobj->naddr, local); 217 237 return EOK; … … 282 302 inet_dgram_t dgram; 283 303 284 dgram.tos = IPC_GET_ARG1(*icall); 285 286 uint8_t ttl = IPC_GET_ARG2(*icall); 304 dgram.iplink = IPC_GET_ARG1(*icall); 305 dgram.tos = IPC_GET_ARG2(*icall); 306 307 uint8_t ttl = IPC_GET_ARG3(*icall); 287 308 int df = IPC_GET_ARG3(*icall); 288 309 … … 524 545 if ((addr != NULL) || 525 546 (inet_naddr_compare_mask(&solicited_node_mask, &packet->dest)) || 526 (inet_addr_compare(&multicast_all_nodes, &packet->dest))) { 547 (inet_addr_compare(&multicast_all_nodes, &packet->dest)) || 548 (inet_addr_compare(&broadcast4_all_hosts, &packet->dest))) { 527 549 /* Destined for one of the local addresses */ 528 550 -
uspace/srv/net/inetsrv/inetsrv.h
r4a90582 r695b6ff 127 127 128 128 typedef struct { 129 service_id_t iplink; 129 130 inet_addr_t src; 130 131 inet_addr_t dest;
Note:
See TracChangeset
for help on using the changeset viewer.
