Commit 544c8bb7 authored by Erik Habbinga's avatar Erik Habbinga Committed by Jeff Garzik

ifenslave sample program updates:

* ifr2.ifr_flags was not initialized in the hwaddr_notset case,
* SIOCGIFFLAGS now called before hwaddr_notset test
parent 3eb31917
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
* take care of this itself * take care of this itself
* - Try the SIOC*** versions of the bonding ioctls before using the * - Try the SIOC*** versions of the bonding ioctls before using the
* old versions * old versions
* - 2002/02/18 Erik Habbinga <erik_habbinga @ hp dot com> :
* - ifr2.ifr_flags was not initialized in the hwaddr_notset case,
* SIOCGIFFLAGS now called before hwaddr_notset test
*/ */
static char *version = static char *version =
...@@ -288,19 +291,19 @@ main(int argc, char **argv) ...@@ -288,19 +291,19 @@ main(int argc, char **argv)
hwaddr from it's first slave. hwaddr from it's first slave.
- if !hwaddr_notset, assign the master's hwaddr to each slave - if !hwaddr_notset, assign the master's hwaddr to each slave
*/ */
strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ);
if (ioctl(skfd, SIOCGIFFLAGS, &ifr2) < 0) {
int saved_errno = errno;
fprintf(stderr, "SIOCGIFFLAGS on %s failed: %s\n", slave_ifname,
strerror(saved_errno));
return 1;
}
if (hwaddr_notset) { /* we do nothing */ if (hwaddr_notset) { /* we do nothing */
} }
else { /* we'll assign master's hwaddr to this slave */ else { /* we'll assign master's hwaddr to this slave */
strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ);
if (ioctl(skfd, SIOCGIFFLAGS, &ifr2) < 0) {
int saved_errno = errno;
fprintf(stderr, "SIOCGIFFLAGS on %s failed: %s\n", slave_ifname,
strerror(saved_errno));
return 1;
}
if (ifr2.ifr_flags & IFF_UP) { if (ifr2.ifr_flags & IFF_UP) {
ifr2.ifr_flags &= ~IFF_UP; ifr2.ifr_flags &= ~IFF_UP;
if (ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) { if (ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment