From: fendo Date: Sat, 21 Sep 2013 12:36:07 +0000 (+0200) Subject: Fix: throttle ipv6 out. X-Git-Tag: 2.2.1-2fdn3.11~1 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/20ca0ebdd35c564524faabf0bfea67d662ac5289?ds=sidebyside;hp=-c Fix: throttle ipv6 out. --- 20ca0ebdd35c564524faabf0bfea67d662ac5289 diff --git a/l2tpns.c b/l2tpns.c index 0167184..4028379 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -1801,6 +1801,8 @@ static void send_ipout(sessionidt s, uint8_t *buf, int len) { sessiont *sp; tunnelidt t; + uint8_t *p; + uint8_t *data = buf; // Keep a copy of the originals. uint8_t b[MAXETHER + 20]; @@ -1823,11 +1825,14 @@ static void send_ipout(sessionidt s, uint8_t *buf, int len) LOG(5, s, t, "Ethernet -> Tunnel (%d bytes)\n", len); // Add on L2TP header - { - uint8_t *p = makeppp(b, sizeof(b), buf, len, s, t, PPPIP, 0, 0, 0); - if (!p) return; - tunnelsend(b, len + (p-b), t); // send it... - } + if (*(uint16_t *) (data + 2) == htons(PKTIPV6)) + p = makeppp(b, sizeof(b), buf, len, s, t, PPPIPV6, 0, 0, 0); // IPV6 + else + p = makeppp(b, sizeof(b), buf, len, s, t, PPPIP, 0, 0, 0); // IPV4 + + if (!p) return; + + tunnelsend(b, len + (p-b), t); // send it... // Snooping this session. if (sp->snoop_ip && sp->snoop_port)