diff options
author | Nicolas Thill <nico@openwrt.org> | 2008-11-13 04:22:05 +0000 |
---|---|---|
committer | Nicolas Thill <nico@openwrt.org> | 2008-11-13 04:22:05 +0000 |
commit | 1af7fe6e2494f6c1cc87a1410ce678e26140bb28 (patch) | |
tree | 8bfa5e1860d1db6af1264b75e7029ef9eac26ef3 /package/busybox | |
parent | 0c58b4ebbc723c69bbef8da7e9162cb0e801d4e6 (diff) | |
download | mtk-20170518-1af7fe6e2494f6c1cc87a1410ce678e26140bb28.zip mtk-20170518-1af7fe6e2494f6c1cc87a1410ce678e26140bb28.tar.gz mtk-20170518-1af7fe6e2494f6c1cc87a1410ce678e26140bb28.tar.bz2 |
fix brctl on linux 2.4
SVN-Revision: 13194
Diffstat (limited to 'package/busybox')
-rw-r--r-- | package/busybox/patches/802-brctl_linux24.patch | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/package/busybox/patches/802-brctl_linux24.patch b/package/busybox/patches/802-brctl_linux24.patch new file mode 100644 index 0000000..6d6dbc7 --- /dev/null +++ b/package/busybox/patches/802-brctl_linux24.patch @@ -0,0 +1,74 @@ +--- a/networking/brctl.c ++++ b/networking/brctl.c +@@ -18,7 +18,7 @@ + + /* Maximum number of ports supported per bridge interface. */ + #ifndef MAX_PORTS +-#define MAX_PORTS 32 ++#define MAX_PORTS 1024 + #endif + + /* Use internal number parsing and not the "exact" conversion. */ +@@ -155,6 +155,7 @@ int brctl_main(int argc ATTRIBUTE_UNUSED + printf(bi.stp_enabled ? "\tyes" : "\tno"); + + /* print interface list */ ++ memset(ifidx, 0, sizeof ifidx); + arm_ioctl(args, BRCTL_GET_PORT_LIST, + (unsigned long) ifidx, MAX_PORTS); + xioctl(fd, SIOCDEVPRIVATE, &ifr); +@@ -183,9 +184,19 @@ int brctl_main(int argc ATTRIBUTE_UNUSED + br = *argv++; + + if (key == ARG_addbr || key == ARG_delbr) { /* addbr or delbr */ +- ioctl_or_perror_and_die(fd, +- key == ARG_addbr ? SIOCBRADDBR : SIOCBRDELBR, +- br, "bridge %s", br); ++ int ret; ++ ret = ioctl(fd, ++ key == ARG_addbr ? SIOCBRADDBR : SIOCBRDELBR, ++ br); ++ if (ret < 0) { ++ arm_ioctl(args, ++ key == ARG_addbr ? BRCTL_ADD_BRIDGE : BRCTL_DEL_BRIDGE, ++ (unsigned long) br, 0); ++ ret = ioctl(fd, SIOCSIFBR, args); ++ } ++ if (ret < 0) { ++ bb_perror_msg_and_die("bridge %s", br); ++ } + goto done; + } + +@@ -194,14 +205,27 @@ int brctl_main(int argc ATTRIBUTE_UNUSED + + strncpy(ifr.ifr_name, br, IFNAMSIZ); + if (key == ARG_addif || key == ARG_delif) { /* addif or delif */ ++ int ret; ++ int if_index; + brif = *argv; +- ifr.ifr_ifindex = if_nametoindex(brif); +- if (!ifr.ifr_ifindex) { ++ if_index = if_nametoindex(brif); ++ if (!if_index) { + bb_perror_msg_and_die("iface %s", brif); + } +- ioctl_or_perror_and_die(fd, ++ ifr.ifr_ifindex = if_index; ++ ret = ioctl(fd, + key == ARG_addif ? SIOCBRADDIF : SIOCBRDELIF, +- &ifr, "bridge %s", br); ++ &ifr); ++ if (ret < 0) { ++ arm_ioctl(args, ++ key == ARG_addif ? BRCTL_ADD_IF : BRCTL_DEL_IF, ++ if_index, 0); ++ ifr.ifr_data = (char *) &args; ++ ret = ioctl(fd, SIOCDEVPRIVATE, &ifr); ++ } ++ if (ret < 0) { ++ bb_perror_msg_and_die("bridge %s", br); ++ } + goto done_next_argv; + } + #if ENABLE_FEATURE_BRCTL_FANCY |