Application of mopd-2.5.3-eaddr.patch:

* Sun Nov 17 2002 Maciej W. Rozycki <macro@ds2.pg.gda.pl> 2.5.3-14
- create the dummy socket for getting the MAC address inside
  pfEthAddr() on Linux (eaddr)

Downloaded from:
ftp://ftp.linux-mips.org/pub/linux/mips/people/macro/mopd/mopd-2.5.3-eaddr.patch.gz
.patch SHA256 = 855ba33eabe1133b76e71aef77d35a959c05fd9d5ae53de8fd98cdaab4006c72
Patch history copied from:
ftp://ftp.linux-mips.org/pub/linux/mips/people/macro/mopd/mopd-2.5.3-15.spec
This commit is contained in:
Maciej W. Rozycki
2002-11-17 12:00:00 -05:00
committed by Boris Gjenero
parent dd4ca7502f
commit 229c12d708
2 changed files with 8 additions and 8 deletions

View File

@@ -152,12 +152,7 @@ deviceOpen(ifname, proto, trans)
#ifdef DEV_NEW_CONF
deviceEthAddr(p->if_name,&p->eaddr[0]);
#elif defined(__linux__)
{
int s;
s = socket(AF_INET,SOCK_DGRAM,0);
pfEthAddr(s,p->if_name,&p->eaddr[0]);
(void) close(s);
}
pfEthAddr(0, p->if_name,&p->eaddr[0]);
#else
p->eaddr[0]= tmp.eaddr[0];
p->eaddr[1]= tmp.eaddr[1];

View File

@@ -204,12 +204,17 @@ int s;
char *interface;
u_char *addr;
{
int err;
strncpy(ifr.ifr_name, interface, sizeof (ifr.ifr_name) - 1);
ifr.ifr_name[sizeof(ifr.ifr_name)] = 0;
ifr.ifr_addr.sa_family = AF_INET;
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
s = socket(AF_INET,SOCK_DGRAM,0);
err = ioctl(s, SIOCGIFHWADDR, &ifr);
(void) close(s);
if (err < 0) {
syslog(LOG_ERR, "pfEthAddr: %s: SIOCGIFHWADDR: %m", interface);
return(-1);
exit(-1);
}
memcpy((char *)addr, ifr.ifr_hwaddr.sa_data, 6);
return(0);