X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/c1d1c2a8c4f22c3911d392393072327b0e319c5e..HEAD:/pppoe.c diff --git a/pppoe.c b/pppoe.c index 01cc153..c6bc12d 100644 --- a/pppoe.c +++ b/pppoe.c @@ -22,6 +22,7 @@ #include #include +#include "dhcp6.h" #include "l2tpns.h" #include "cluster.h" #include "constants.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