1 --- a/networking/brctl.c
2 +++ b/networking/brctl.c
5 /* Maximum number of ports supported per bridge interface. */
8 +#define MAX_PORTS 1024
11 /* Use internal number parsing and not the "exact" conversion. */
12 @@ -169,6 +169,7 @@ int brctl_main(int argc UNUSED_PARAM, ch
13 printf(bi.stp_enabled ? "\tyes" : "\tno");
15 /* print interface list */
16 + memset(ifidx, 0, sizeof ifidx);
17 arm_ioctl(args, BRCTL_GET_PORT_LIST,
18 (unsigned long) ifidx, MAX_PORTS);
19 xioctl(fd, SIOCDEVPRIVATE, &ifr);
20 @@ -197,9 +198,19 @@ int brctl_main(int argc UNUSED_PARAM, ch
23 if (key == ARG_addbr || key == ARG_delbr) { /* addbr or delbr */
24 - ioctl_or_perror_and_die(fd,
25 - key == ARG_addbr ? SIOCBRADDBR : SIOCBRDELBR,
26 - br, "bridge %s", br);
29 + key == ARG_addbr ? SIOCBRADDBR : SIOCBRDELBR,
33 + key == ARG_addbr ? BRCTL_ADD_BRIDGE : BRCTL_DEL_BRIDGE,
34 + (unsigned long) br, 0);
35 + ret = ioctl(fd, SIOCSIFBR, args);
38 + bb_perror_msg_and_die("bridge %s", br);
43 @@ -208,14 +219,27 @@ int brctl_main(int argc UNUSED_PARAM, ch
45 strncpy_IFNAMSIZ(ifr.ifr_name, br);
46 if (key == ARG_addif || key == ARG_delif) { /* addif or delif */
50 - ifr.ifr_ifindex = if_nametoindex(brif);
51 - if (!ifr.ifr_ifindex) {
52 + if_index = if_nametoindex(brif);
54 bb_perror_msg_and_die("iface %s", brif);
56 - ioctl_or_perror_and_die(fd,
57 + ifr.ifr_ifindex = if_index;
59 key == ARG_addif ? SIOCBRADDIF : SIOCBRDELIF,
60 - &ifr, "bridge %s", br);
64 + key == ARG_addif ? BRCTL_ADD_IF : BRCTL_DEL_IF,
66 + ifr.ifr_data = (char *) &args;
67 + ret = ioctl(fd, SIOCDEVPRIVATE, &ifr);
70 + bb_perror_msg_and_die("bridge %s", br);
74 #if ENABLE_FEATURE_BRCTL_FANCY