diff -ru ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c --- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c 2005-03-22 15:22:32.000000000 +0500 +++ ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c 2009-11-03 11:12:28.000000000 +0500 @@ -369,6 +369,11 @@ printErr("Ignoring PADO packet from broadcast MAC address"); continue; } + if (conn->req_peer + && memcmp(packet.ethHdr.h_source, conn->req_peer_mac, ETH_ALEN) != 0) { + warn("Ignoring PADO packet from wrong MAC address"); + continue; + } parsePacket(&packet, parsePADOTags, &pc); if (!pc.seenACName) { printErr("Ignoring PADO packet with no AC-Name tag"); diff -ru ppp-2.4.4.orig/pppd/plugins/rp-pppoe/plugin.c ppp-2.4.4/pppd/plugins/rp-pppoe/plugin.c --- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/plugin.c 2006-05-30 05:29:16.000000000 +0600 +++ ppp-2.4.4/pppd/plugins/rp-pppoe/plugin.c 2009-11-03 11:12:28.000000000 +0500 @@ -63,6 +63,8 @@ static char *acName = NULL; static char *existingSession = NULL; static int printACNames = 0; +static char *pppoe_reqd_mac = NULL; +unsigned char pppoe_reqd_mac_addr[6]; static int PPPoEDevnameHook(char *cmd, char **argv, int doit); static option_t Options[] = { @@ -78,6 +80,8 @@ "Attach to existing session (sessid:macaddr)" }, { "rp_pppoe_verbose", o_int, &printACNames, "Be verbose about discovered access concentrators"}, + { "pppoe-mac", o_string, &pppoe_reqd_mac, + "Only connect to specified MAC address" }, { NULL } }; @@ -381,6 +385,21 @@ void pppoe_check_options(void) { + unsigned int mac[6]; + int i; + + if (pppoe_reqd_mac != NULL) { + if (sscanf(pppoe_reqd_mac, "%x:%x:%x:%x:%x:%x", + &mac[0], &mac[1], &mac[2], &mac[3], + &mac[4], &mac[5]) != 6) { + option_error("cannot parse pppoe-mac option value"); + exit(EXIT_OPTION_ERROR); + } + for (i = 0; i < 6; ++i) + conn->req_peer_mac[i] = mac[i]; + conn->req_peer = 1; + } + lcp_allowoptions[0].neg_accompression = 0; lcp_wantoptions[0].neg_accompression = 0; diff -ru ppp-2.4.4.orig/pppd/plugins/rp-pppoe/pppoe.h ppp-2.4.4/pppd/plugins/rp-pppoe/pppoe.h --- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/pppoe.h 2004-11-04 15:07:37.000000000 +0500 +++ ppp-2.4.4/pppd/plugins/rp-pppoe/pppoe.h 2009-11-03 11:12:28.000000000 +0500 @@ -254,6 +254,8 @@ int sessionSocket; /* Raw socket for session frames */ unsigned char myEth[ETH_ALEN]; /* My MAC address */ unsigned char peerEth[ETH_ALEN]; /* Peer's MAC address */ + unsigned char req_peer_mac[ETH_ALEN]; /* required peer MAC address */ + unsigned char req_peer; /* require mac addr to match req_peer_mac */ UINT16_t session; /* Session ID */ char *ifName; /* Interface name */ char *serviceName; /* Desired service name, if any */