Root/package/busybox/patches/802-brctl_linux24.patch

1--- a/networking/brctl.c
2+++ b/networking/brctl.c
3@@ -32,7 +32,7 @@
4 
5 /* Maximum number of ports supported per bridge interface. */
6 #ifndef MAX_PORTS
7-#define MAX_PORTS 32
8+#define MAX_PORTS 1024
9 #endif
10 
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");
14 
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
21         br = *argv++;
22 
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);
27+ int ret;
28+ ret = ioctl(fd,
29+ key == ARG_addbr ? SIOCBRADDBR : SIOCBRDELBR,
30+ br);
31+ if (ret < 0) {
32+ arm_ioctl(args,
33+ key == ARG_addbr ? BRCTL_ADD_BRIDGE : BRCTL_DEL_BRIDGE,
34+ (unsigned long) br, 0);
35+ ret = ioctl(fd, SIOCSIFBR, args);
36+ }
37+ if (ret < 0) {
38+ bb_perror_msg_and_die("bridge %s", br);
39+ }
40             goto done;
41         }
42 
43@@ -208,14 +219,27 @@ int brctl_main(int argc UNUSED_PARAM, ch
44 
45         strncpy_IFNAMSIZ(ifr.ifr_name, br);
46         if (key == ARG_addif || key == ARG_delif) { /* addif or delif */
47+ int ret;
48+ int if_index;
49             brif = *argv;
50- ifr.ifr_ifindex = if_nametoindex(brif);
51- if (!ifr.ifr_ifindex) {
52+ if_index = if_nametoindex(brif);
53+ if (!if_index) {
54                 bb_perror_msg_and_die("iface %s", brif);
55             }
56- ioctl_or_perror_and_die(fd,
57+ ifr.ifr_ifindex = if_index;
58+ ret = ioctl(fd,
59                     key == ARG_addif ? SIOCBRADDIF : SIOCBRDELIF,
60- &ifr, "bridge %s", br);
61+ &ifr);
62+ if (ret < 0) {
63+ arm_ioctl(args,
64+ key == ARG_addif ? BRCTL_ADD_IF : BRCTL_DEL_IF,
65+ if_index, 0);
66+ ifr.ifr_data = (char *) &args;
67+ ret = ioctl(fd, SIOCDEVPRIVATE, &ifr);
68+ }
69+ if (ret < 0) {
70+ bb_perror_msg_and_die("bridge %s", br);
71+ }
72             goto done_next_argv;
73         }
74 #if ENABLE_FEATURE_BRCTL_FANCY
75

Archive Download this file



interactive