IPv6 load-balancing
[l2tpns.git] / ppp.c
diff --git a/ppp.c b/ppp.c
index c4f9ab4..29bf1bc 100644 (file)
--- a/ppp.c
+++ b/ppp.c
@@ -1482,6 +1482,7 @@ void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
 static void ipv6cp_open(sessionidt s, tunnelidt t)
 {
        int i;
+       groupidt g;
        LOG(3, s, t, "IPV6CP: Opened\n");
 
        change_state(s, ipv6cp, Opened);
@@ -1497,6 +1498,12 @@ static void ipv6cp_open(sessionidt s, tunnelidt t)
                        route6set(s, session[s].ipv6address, 128, 1);
        }
 
+       if ((g = grp_groupbysession(s)))
+       {
+               grp_setgrouproute6(g, 1);
+               cluster_send_groupe(g);
+       }
+
        // Send an initial RA (TODO: Should we send these regularly?)
        send_ipv6_ra(s, t, NULL);
 }
@@ -2267,7 +2274,8 @@ void processipv6in(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
        if (session[s].ipv6address.s6_addr[0])
        {
                if ((sessionbyipv6new(ip) != s) &&
-                       (ip.s6_addr[0] != 0xFE || ip.s6_addr[1] != 0x80 || ip.s6_addr16[1] != 0 || ip.s6_addr16[2] != 0 || ip.s6_addr16[3] != 0))
+                       (ip.s6_addr[0] != 0xFE || ip.s6_addr[1] != 0x80 || ip.s6_addr16[1] != 0 || ip.s6_addr16[2] != 0 || ip.s6_addr16[3] != 0) &&
+                       (!grp_groupbyipv6(ip)))
                {
                        char str[INET6_ADDRSTRLEN];
                        LOG(5, s, t, "Dropping packet with spoofed IP %s\n",