X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/b85ea8667082555c4ae3a94650921584cfbcb3bb..e7c9a1993778e9ac375d7f956dda7c3c802a83a5:/pppoe.c?ds=inline diff --git a/pppoe.c b/pppoe.c index 4b196ea..40e898e 100644 --- a/pppoe.c +++ b/pppoe.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "l2tpns.h" #include "cluster.h" @@ -502,20 +503,27 @@ static void pppoe_recv_PADI(uint8_t *pack, int size) return; len = ntohs(hdr->length); - for (n = 0; n < len; n += sizeof(*tag) + ntohs(tag->tag_len)) { + for (n = 0; n < len; n += sizeof(*tag) + ntohs(tag->tag_len)) + { tag = (struct pppoe_tag *)(pack + ETH_HLEN + sizeof(*hdr) + n); if (n + sizeof(*tag) + ntohs(tag->tag_len) > len) return; - switch (ntohs(tag->tag_type)) { + switch (ntohs(tag->tag_type)) + { case TAG_END_OF_LIST: break; case TAG_SERVICE_NAME: - if (*config->pppoe_service_name && tag->tag_len) + if (config->pppoe_only_equal_svc_name && *config->pppoe_service_name && !tag->tag_len) + { + break; + } + else if (*config->pppoe_service_name && tag->tag_len) { if (ntohs(tag->tag_len) != strlen(config->pppoe_service_name)) break; if (memcmp(tag->tag_data, config->pppoe_service_name, ntohs(tag->tag_len))) break; + service_name_tag = tag; service_match = 1; } else @@ -902,7 +910,6 @@ void process_pppoe_disc(uint8_t *pack, int size) } } -#ifdef LAC // Forward from pppoe to l2tp remote LNS static void pppoe_forwardto_session_rmlns(uint8_t *pack, int size, sessionidt sess, uint16_t proto) { @@ -1036,7 +1043,6 @@ void pppoe_forwardto_session_pppoe(uint8_t *pack, int size, sessionidt sess, uin tunnelsend(p, lpppoe, t); // send it.... } -#endif void process_pppoe_sess(uint8_t *pack, int size) { @@ -1101,13 +1107,11 @@ void process_pppoe_sess(uint8_t *pack, int size) lppp -= 2; } -#ifdef LAC if (session[sid].forwardtosession) { // Must be forwaded to a remote lns tunnel l2tp pppoe_forwardto_session_rmlns(pack, size, sid, proto); return; } -#endif if (proto == PPPPAP) {