X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Frp-pppoe%2Fpppoe-discovery.c;h=c97033739e0f0504a03dadc7ac4632973e08321a;hb=2ff8d30b889d33d3dd881257210d0ebb0806c76f;hp=f19c6d8b58318203430401ab641236be82d24c4e;hpb=b1fcf16fa66159f380ee4abd7c9a76b59809dc7b;p=ppp.git diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c index f19c6d8..c970337 100644 --- a/pppd/plugins/rp-pppoe/pppoe-discovery.c +++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c @@ -29,10 +29,6 @@ #include #endif -#ifdef HAVE_NET_ETHERNET_H -#include -#endif - #ifdef HAVE_ASM_TYPES_H #include #endif @@ -328,14 +324,10 @@ void parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data, void *extra) { - int *val = (int *) extra; - if (type == TAG_HOST_UNIQ && len == sizeof(pid_t)) { - pid_t tmp; - memcpy(&tmp, data, len); - if (tmp == getpid()) { - *val = 1; - } - } + PPPoETag *tag = extra; + + if (type == TAG_HOST_UNIQ && len == ntohs(tag->length)) + tag->length = memcmp(data, tag->payload, len); } /********************************************************************** @@ -352,7 +344,7 @@ parseForHostUniq(UINT16_t type, UINT16_t len, unsigned char *data, int packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet) { - int forMe = 0; + PPPoETag hostUniq = conn->hostUniq; /* If packet is not directed to our MAC address, forget it */ if (memcmp(packet->ethHdr.h_dest, conn->myEth, ETH_ALEN)) return 0; @@ -360,8 +352,8 @@ packetIsForMe(PPPoEConnection *conn, PPPoEPacket *packet) /* If we're not using the Host-Unique tag, then accept the packet */ if (!conn->hostUniq.length) return 1; - parsePacket(packet, parseForHostUniq, &forMe); - return forMe; + parsePacket(packet, parseForHostUniq, &hostUniq); + return !hostUniq.length; } /**********************************************************************