VirtualBox

Changeset 50185 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jan 23, 2014 4:19:13 PM (11 years ago)
Author:
vboxsync
Message:

lwip: Sync with git master up to

commit 5070cc07be60379848416b067d47ccd2d8e14d25
Date: Fri Jan 17 21:57:40 2014 +0100

A set of changes for IPv6 loopback support. These changes don't
affect VBox since we don't use lwip loopback. Same object code is
generated.

Location:
trunk/src/VBox/Devices/Network/lwip-new
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/lwip-new/CHANGELOG

    r50173 r50185  
    8080
    8181 ++ Bugfixes:
     82
     83  2014-01-17: Grant Erickson, Jay Logue, Simon Goldschmidt
     84  * ipv6.c, netif.c: patch #7913 Enable Support for IPv6 Loopback
     85
     86  2014-01-16: Stathis Voukelatos
     87  * netif.c: patch #7902 Fixed netif_poll() operation when LWIP_LOOPBACK_MAX_PBUFS > 0
    8288
    8389  2014-01-14: "Freddie Chopin"
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv4/ip4.c

    r49854 r50185  
    880880    /* Packet to self, enqueue it for loopback */
    881881    LWIP_DEBUGF(IP_DEBUG, ("netif_loop_output()"));
    882     return netif_loop_output(netif, p, dest);
     882    return netif_loop_output(netif, p);
    883883  }
    884884#if LWIP_IGMP
    885885  if ((p->flags & PBUF_FLAG_MCASTLOOP) != 0) {
    886     netif_loop_output(netif, p, dest);
     886    netif_loop_output(netif, p);
    887887  }
    888888#endif /* LWIP_IGMP */
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/ipv6/ip6.c

    r50020 r50185  
    948948
    949949#if ENABLE_LOOPBACK
    950   /* TODO implement loopback for v6
    951   if (ip6_addr_cmp(dest, netif_ip6_addr(0))) {
    952     return netif_loop_output(netif, p, dest);
    953   }*/
     950  {
     951    int i;
     952    for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
     953      if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
     954          ip6_addr_cmp(dest, netif_ip6_addr(netif, i))) {
     955        /* Packet to self, enqueue it for loopback */
     956        LWIP_DEBUGF(IP6_DEBUG, ("netif_loop_output()\n"));
     957        return netif_loop_output(netif, p);
     958      }
     959    }
     960  }
    954961#endif /* ENABLE_LOOPBACK */
    955962#if LWIP_IPV6_FRAG
     
    960967#endif /* LWIP_IPV6_FRAG */
    961968
    962   LWIP_DEBUGF(IP6_DEBUG, ("netif->output_ip6()"));
     969  LWIP_DEBUGF(IP6_DEBUG, ("netif->output_ip6()\n"));
    963970  return netif->output_ip6(netif, p, dest);
    964971}
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/netif.c

    r48287 r50185  
    8989#endif /* LWIP_IPV6 */
    9090
     91#if LWIP_IPV6
     92#define ipX_input(in, netif) (IP6H_V((const struct ip6_hdr *)in->payload) == 6) ? ip6_input(in, netif) : ip_input(in, netif)
     93#else
     94#define ipX_input(in, netif) ip_input(in, netif)
     95#endif
     96
    9197#if LWIP_HAVE_LOOPIF
     98static err_t netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, ip_addr_t* addr);
     99#if LWIP_IPV6
     100static err_t netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, ip6_addr_t* addr);
     101#endif
     102
     103
    92104static struct netif loop_netif;
    93105
     
    109121  netif->name[0] = 'l';
    110122  netif->name[1] = 'o';
    111   netif->output = netif_loop_output;
     123  netif->output = netif_loop_output_ipv4;
     124#if LWIP_IPV6
     125  netif->output_ip6 = netif_loop_output_ipv6;
     126#endif
    112127  return ERR_OK;
    113128}
     
    128143  netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, netif_loopif_init, tcpip_input);
    129144#endif /* NO_SYS */
     145
     146#if LWIP_IPV6
     147  loop_netif.ip6_addr[0].addr[0] = 0;
     148  loop_netif.ip6_addr[0].addr[1] = 0;
     149  loop_netif.ip6_addr[0].addr[2] = 0;
     150  loop_netif.ip6_addr[0].addr[3] = PP_HTONL(0x00000001UL);
     151  loop_netif.ip6_addr_state[0] = IP6_ADDR_VALID;
     152#endif /* LWIP_IPV6 */
     153
    130154  netif_set_up(&loop_netif);
    131155
     
    656680 * @param netif the lwip network interface structure
    657681 * @param p the (IP) packet to 'send'
    658  * @param ipaddr the ip address to send the packet to (not used)
    659682 * @return ERR_OK if the packet has been sent
    660683 *         ERR_MEM if the pbuf used to copy the packet couldn't be allocated
    661684 */
    662685err_t
    663 netif_loop_output(struct netif *netif, struct pbuf *p,
    664        ip_addr_t *ipaddr)
     686netif_loop_output(struct netif *netif, struct pbuf *p)
    665687{
    666688  struct pbuf *r;
     
    680702#endif /* LWIP_SNMP */
    681703  SYS_ARCH_DECL_PROTECT(lev);
    682   LWIP_UNUSED_ARG(ipaddr);
    683704
    684705  /* Allocate a new pbuf */
     
    741762  return ERR_OK;
    742763}
     764
     765static err_t
     766netif_loop_output_ipv4(struct netif *netif, struct pbuf *p, ip_addr_t* addr)
     767{
     768  LWIP_UNUSED_ARG(addr);
     769  return netif_loop_output(netif, p);
     770}
     771
     772#if LWIP_IPV6
     773static err_t
     774netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, ip6_addr_t* addr)
     775{
     776  LWIP_UNUSED_ARG(addr);
     777  return netif_loop_output(netif, p);
     778}
     779#endif
     780
    743781
    744782/**
     
    770808      struct pbuf *in_end = in;
    771809#if LWIP_LOOPBACK_MAX_PBUFS
    772       u8_t clen = pbuf_clen(in);
     810      u8_t clen = 1;
     811#endif /* LWIP_LOOPBACK_MAX_PBUFS */
     812      while (in_end->len != in_end->tot_len) {
     813        LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL);
     814        in_end = in_end->next;
     815#if LWIP_LOOPBACK_MAX_PBUFS
     816        clen++;
     817#endif /* LWIP_LOOPBACK_MAX_PBUFS */
     818      }
     819#if LWIP_LOOPBACK_MAX_PBUFS
    773820      /* adjust the number of pbufs on queue */
    774821      LWIP_ASSERT("netif->loop_cnt_current underflow",
     
    776823      netif->loop_cnt_current -= clen;
    777824#endif /* LWIP_LOOPBACK_MAX_PBUFS */
    778       while (in_end->len != in_end->tot_len) {
    779         LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL);
    780         in_end = in_end->next;
    781       }
     825
    782826      /* 'in_end' now points to the last pbuf from 'in' */
    783827      if (in_end == netif->loop_last) {
     
    799843      snmp_inc_ifinucastpkts(stats_if);
    800844      /* loopback packets are always IP packets! */
    801       if (ip_input(in, netif) != ERR_OK) {
     845      if (ipX_input(in, netif) != ERR_OK) {
    802846        pbuf_free(in);
    803847      }
  • trunk/src/VBox/Devices/Network/lwip-new/src/include/ipv6/lwip/ip6_addr.h

    r49586 r50185  
    171171                             ((ip6addr)->addr[3] == 0)))
    172172
     173#define ip6_addr_isloopback(ip6addr) (((ip6addr)->addr[0] == 0UL) && \
     174                                      ((ip6addr)->addr[1] == 0UL) && \
     175                                      ((ip6addr)->addr[2] == 0UL) && \
     176                                      ((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
    173177
    174178#define ip6_addr_isglobal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xe0000000UL)) == PP_HTONL(0x20000000UL))
  • trunk/src/VBox/Devices/Network/lwip-new/src/include/lwip/netif.h

    r47886 r50185  
    360360
    361361#if ENABLE_LOOPBACK
    362 err_t netif_loop_output(struct netif *netif, struct pbuf *p, ip_addr_t *dest_ip);
     362err_t netif_loop_output(struct netif *netif, struct pbuf *p);
    363363void netif_poll(struct netif *netif);
    364364#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
Note: See TracChangeset for help on using the changeset viewer.

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