Add param disable no spoof
authorfendo <fendo@bi12info.com>
Sun, 10 Feb 2013 23:15:36 +0000 (00:15 +0100)
committerfendo <fendo@bi12info.com>
Sun, 10 Feb 2013 23:15:36 +0000 (00:15 +0100)
l2tpns.c
l2tpns.h
ppp.c

index ee9f30b..1a37a0a 100644 (file)
--- a/l2tpns.c
+++ b/l2tpns.c
@@ -191,6 +191,7 @@ config_descriptt config_values[] = {
        CONFIG("pppoe_service_name", pppoe_service_name, STRING),
        CONFIG("pppoe_ac_name", pppoe_ac_name, STRING),
        CONFIG("disable_sending_hello", disable_sending_hello, BOOL),
        CONFIG("pppoe_service_name", pppoe_service_name, STRING),
        CONFIG("pppoe_ac_name", pppoe_ac_name, STRING),
        CONFIG("disable_sending_hello", disable_sending_hello, BOOL),
+       CONFIG("disable_no_spoof", disable_no_spoof, BOOL),
        { NULL, 0, 0, 0 }
 };
 
        { NULL, 0, 0, 0 }
 };
 
index 1d3339c..56f8fa1 100644 (file)
--- a/l2tpns.h
+++ b/l2tpns.h
@@ -780,6 +780,7 @@ typedef struct
        char pppoe_ac_name[64];
        uint8_t pppoe_hwaddr[ETH_ALEN]; // MAC addr of interface pppoe to bind
        int disable_sending_hello; // Disable l2tp sending HELLO message for Apple compatibility.
        char pppoe_ac_name[64];
        uint8_t pppoe_hwaddr[ETH_ALEN]; // MAC addr of interface pppoe to bind
        int disable_sending_hello; // Disable l2tp sending HELLO message for Apple compatibility.
+       int disable_no_spoof; // Disable no spoof (permit load balancing client --> internet)
 } configt;
 
 enum config_typet { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IPv4, IPv6 };
 } configt;
 
 enum config_typet { INT, STRING, UNSIGNED_LONG, SHORT, BOOL, IPv4, IPv6 };
diff --git a/ppp.c b/ppp.c
index a8a355d..893ceb9 100644 (file)
--- a/ppp.c
+++ b/ppp.c
@@ -1769,7 +1769,7 @@ void processipin(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
        if (!session[s].bundle || bundle[session[s].bundle].num_of_links < 2) // FIXME: 
        {
                // no spoof (do sessionbyip to handled statically routed subnets)
        if (!session[s].bundle || bundle[session[s].bundle].num_of_links < 2) // FIXME: 
        {
                // no spoof (do sessionbyip to handled statically routed subnets)
-               if (ip != session[s].ip && sessionbyip(htonl(ip)) != s)
+               if (!config->disable_no_spoof && ip != session[s].ip && sessionbyip(htonl(ip)) != s)
                {
                        LOG(4, s, t, "Dropping packet with spoofed IP %s\n", fmtaddr(htonl(ip), 0));
                        return;
                {
                        LOG(4, s, t, "Dropping packet with spoofed IP %s\n", fmtaddr(htonl(ip), 0));
                        return;