VirtualBox

Changeset 49592 in vbox for trunk/src


Ignore:
Timestamp:
Nov 21, 2013 1:39:07 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
90797
Message:

A bit of glue to proxy IPv6 echo requests.

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/ipv6/icmp6.c

    r47886 r49592  
    6666/* Forward declarations */
    6767static void icmp6_send_response(struct pbuf *p, u8_t code, u32_t data, u8_t type);
     68
     69#if LWIP_CONNECTION_PROXY
     70static ping6_proxy_fn ping6_proxy_accept_callback;
     71static void *ping6_proxy_accept_arg;
     72#endif
    6873
    6974
     
    199204}
    200205
     206
     207#if LWIP_CONNECTION_PROXY
     208
     209void
     210ping6_proxy_accept(ping6_proxy_fn callback, void *arg)
     211{
     212  ping6_proxy_accept_callback = callback;
     213  ping6_proxy_accept_arg = arg;
     214}
     215
     216
     217void
     218icmp6_proxy_input(struct pbuf *p, struct netif *inp)
     219{
     220  struct icmp6_hdr *icmp6hdr;
     221  struct pbuf * r;
     222  ip6_addr_t * reply_src;
     223
     224  ICMP6_STATS_INC(icmp6.recv);
     225
     226  /* Check that ICMPv6 header fits in payload */
     227  if (p->len < sizeof(struct icmp6_hdr)) {
     228    /* drop short packets */
     229    pbuf_free(p);
     230    ICMP6_STATS_INC(icmp6.lenerr);
     231    ICMP6_STATS_INC(icmp6.drop);
     232    return;
     233  }
     234
     235  icmp6hdr = (struct icmp6_hdr *)p->payload;
     236  if (ip6_chksum_pseudo(p, IP6_NEXTH_ICMP6, p->tot_len, ip6_current_src_addr(),
     237                        ip6_current_dest_addr()) != 0) {
     238    /* Checksum failed */
     239    pbuf_free(p);
     240    ICMP6_STATS_INC(icmp6.chkerr);
     241    ICMP6_STATS_INC(icmp6.drop);
     242    return;
     243  }
     244
     245  switch (icmp6hdr->type) {
     246
     247  case ICMP6_TYPE_EREQ:
     248    if (ping6_proxy_accept_callback != NULL) {
     249      (*ping6_proxy_accept_callback)(ping6_proxy_accept_arg, p);
     250      return;
     251    }
     252    ICMP6_STATS_INC(icmp6.drop);
     253    break;
     254
     255  case ICMP6_TYPE_EREP:
     256    /* ignore silently */
     257    ICMP6_STATS_INC(icmp6.drop);
     258    break;
     259
     260  default:
     261    ICMP6_STATS_INC(icmp6.drop);
     262    break;
     263  }
     264
     265  pbuf_free(p);
     266}
     267#endif /* LWIP_CONNECTION_PROXY */
    201268
    202269/**
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/ip6.c

    r49041 r49592  
    779779      break;
    780780#endif /* LWIP_TCP */
     781
     782#if LWIP_ICMP6
     783    case IP6_NEXTH_ICMP6:
     784      /* Point to payload. */
     785      pbuf_header(p, -ip_data.current_ip_header_tot_len);
     786      icmp6_proxy_input(p, inp);
     787      break;
     788#endif /* LWIP_ICMP */
    781789
    782790    default:
  • trunk/src/VBox/Devices/Network/lwip-new/src/include/ipv6/lwip/icmp6.h

    r47886 r49592  
    137137
    138138void icmp6_input(struct pbuf *p, struct netif *inp);
     139#if LWIP_CONNECTION_PROXY
     140void icmp6_proxy_input(struct pbuf *p, struct netif *inp);
     141#endif
    139142void icmp6_dest_unreach(struct pbuf *p, enum icmp6_dur_code c);
    140143void icmp6_packet_too_big(struct pbuf *p, u32_t mtu);
    141144void icmp6_time_exceeded(struct pbuf *p, enum icmp6_te_code c);
    142145void icmp6_param_problem(struct pbuf *p, enum icmp6_pp_code c, u32_t pointer);
     146
     147#if LWIP_CONNECTION_PROXY
     148typedef void (*ping6_proxy_fn)(void *arg, struct pbuf *p);
     149void ping6_proxy_accept(ping6_proxy_fn callback, void *arg);
     150#endif
    143151
    144152#endif /* LWIP_ICMP6 && LWIP_IPV6 */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette