Changeset 49514 in vbox for trunk/src/VBox
- Timestamp:
- Nov 16, 2013 1:31:38 AM (11 years ago)
- Location:
- trunk/src/VBox/Devices/Network/lwip-new/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/icmp.c
r47886 r49514 64 64 65 65 static void icmp_send_response(struct pbuf *p, u8_t type, u8_t code); 66 67 #if LWIP_CONNECTION_PROXY 68 static ping_proxy_fn ping_proxy_accept_callback; 69 static void* ping_proxy_accept_arg; 70 #endif 71 66 72 67 73 /** … … 248 254 } 249 255 256 #if LWIP_CONNECTION_PROXY 257 258 void 259 ping_proxy_accept(ping_proxy_fn callback, void *arg) 260 { 261 ping_proxy_accept_callback = callback; 262 ping_proxy_accept_arg = arg; 263 } 264 265 266 /** 267 * Proxy ICMP input packets, called from ip_input(). 268 * 269 * @param p the icmp echo request packet, p->payload pointing to the icmp header 270 * @param inp the netif on which this packet was received 271 */ 272 void 273 icmp_proxy_input(struct pbuf *p, struct netif *inp) 274 { 275 u8_t type, code; 276 277 ICMP_STATS_INC(icmp.recv); 278 snmp_inc_icmpinmsgs(); 279 280 if (p->tot_len < 4) { /* type(1), code(1), checksum(2) */ 281 LWIP_DEBUGF(ICMP_DEBUG, 282 ("icmp_proxy_input: short ICMP (%"U16_F" bytes) received\n", 283 p->tot_len)); 284 goto lenerr; 285 } 286 287 if (inet_chksum_pbuf(p) != 0) { 288 LWIP_DEBUGF(ICMP_DEBUG, ("icmp_proxy_input: bad checksum\n")); 289 pbuf_free(p); 290 ICMP_STATS_INC(icmp.chkerr); 291 snmp_inc_icmpinerrors(); 292 return; 293 } 294 295 type = *((u8_t *)p->payload); 296 code = *(((u8_t *)p->payload)+1); 297 switch (type) { 298 299 case ICMP_ER: 300 /* ignore silently */ 301 pbuf_free(p); 302 break; 303 304 case ICMP_DUR: 305 /* TODO: anything useful we can do? */ 306 pbuf_free(p); 307 break; 308 309 case ICMP_ECHO: 310 if (code != 0) { 311 goto proterr; 312 } 313 if (p->tot_len < 8) { 314 goto lenerr; 315 } 316 317 if (ping_proxy_accept_callback != NULL) { 318 (*ping_proxy_accept_callback)(ping_proxy_accept_arg, p); 319 } 320 break; 321 322 default: 323 goto proterr; 324 } 325 return; 326 327 lenerr: 328 ICMP_STATS_INC(icmp.lenerr); 329 goto drop; 330 331 proterr: 332 LWIP_DEBUGF(ICMP_DEBUG, 333 ("icmp_proxy_input: ICMP type %"S16_F" code %"S16_F 334 " not supported.\n", 335 (s16_t)type, (s16_t)code)); 336 ICMP_STATS_INC(icmp.proterr); 337 goto drop; 338 339 drop: 340 pbuf_free(p); 341 ICMP_STATS_INC(icmp.drop); 342 snmp_inc_icmpinerrors(); 343 return; 344 } 345 #endif /* LWIP_CONNECTION_PROXY */ 346 250 347 /** 251 348 * Send an icmp 'destination unreachable' packet, called from ip_input() if -
trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/ip4.c
r47886 r49514 614 614 615 615 switch (IPH_PROTO(iphdr)) { 616 617 #if LWIP_ICMP 618 case IP_PROTO_ICMP: 619 icmp_proxy_input(p, inp); 620 break; 621 #endif 616 622 617 623 #if LWIP_UDP -
trunk/src/VBox/Devices/Network/lwip-new/src/include/ipv4/lwip/icmp.h
r47886 r49514 45 45 extern "C" { 46 46 #endif 47 48 #define ICMP_HLEN 8 47 49 48 50 #define ICMP_ER 0 /* echo reply */ … … 104 106 105 107 void icmp_input(struct pbuf *p, struct netif *inp); 108 #if LWIP_CONNECTION_PROXY 109 void icmp_proxy_input(struct pbuf *p, struct netif *inp); 110 #endif 106 111 void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); 107 112 void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); 113 114 #if LWIP_CONNECTION_PROXY 115 typedef void (*ping_proxy_fn)(void *arg, struct pbuf *p); 116 void ping_proxy_accept(ping_proxy_fn callback, void *arg); 117 #endif 108 118 109 119 #endif /* LWIP_ICMP */
Note:
See TracChangeset
for help on using the changeset viewer.