Fix: IPv6 prefix routing on slave cluster
authorfendo <fendo@bi12info.com>
Sun, 21 Sep 2014 11:59:08 +0000 (13:59 +0200)
committerfendo <fendo@bi12info.com>
Sun, 21 Sep 2014 11:59:08 +0000 (13:59 +0200)
l2tpns.c

index dd1e8ae..14892f7 100644 (file)
--- a/l2tpns.c
+++ b/l2tpns.c
@@ -982,7 +982,6 @@ static sessionidt lookup_ipv6map(struct in6_addr ip)
        int s;
        char ipv6addr[INET6_ADDRSTRLEN];
 
-       curnode = &ipv6_hash[ip.s6_addr[0]];
        curnode = &ipv6_hash[((ip.s6_addr[0]) & 0xF0)>>4];
        i = 1;
        s = curnode->sess;
@@ -5916,9 +5915,12 @@ int load_session(sessionidt s, sessiont *new)
        }
 
        // check v6 routing
-       for (i = 0; i < MAXROUTE6 && new->route6[i].ipv6prefixlen; i++)
+       if (new->ppp.ipv6cp == Opened && session[s].ppp.ipv6cp != Opened)
        {
-               route6set(s, new->route6[i].ipv6route, new->route6[i].ipv6prefixlen, 1);
+               for (i = 0; i < MAXROUTE6 && new->route6[i].ipv6prefixlen; i++)
+               {
+                       route6set(s, new->route6[i].ipv6route, new->route6[i].ipv6prefixlen, 1);
+               }
        }
 
        if (new->ipv6address.s6_addr[0] && new->ppp.ipv6cp == Opened && session[s].ppp.ipv6cp != Opened)