X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/df35f4d66fd01268fe4456994368b76a541acec4..781b0fde104ecf5f22c9c5322e58180f0b4a88a5:/pppoe.c diff --git a/pppoe.c b/pppoe.c index ca1c5e4..25ab798 100644 --- a/pppoe.c +++ b/pppoe.c @@ -23,6 +23,7 @@ #include #include +#include "dhcp6.h" #include "l2tpns.h" #include "cluster.h" #include "constants.h" @@ -503,20 +504,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 @@ -903,7 +911,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) { @@ -957,7 +964,6 @@ static void pppoe_forwardto_session_rmlns(uint8_t *pack, int size, sessionidt se // Update STAT OUT increment_counter(&session[s].cout, &session[s].cout_wrap, ll2tp); // byte count session[s].cout_delta += ll2tp; - session[s].coutgrp_delta += ll2tp; session[s].pout++; sess_local[s].cout += ll2tp; sess_local[s].pout++; @@ -1029,7 +1035,6 @@ void pppoe_forwardto_session_pppoe(uint8_t *pack, int size, sessionidt sess, uin // Update STAT OUT increment_counter(&session[s].cout, &session[s].cout_wrap, lpppoe); // byte count session[s].cout_delta += lpppoe; - session[s].coutgrp_delta += lpppoe; session[s].pout++; sess_local[s].cout += lpppoe; sess_local[s].pout++; @@ -1039,7 +1044,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) { @@ -1104,13 +1108,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) {