From e609faddbceb91040005a7e84c07a15277485b89 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sep 09 2006 08:26:48 +0000 Subject: bridge-utils updates --- diff --git a/bridge-utils-1.1-itsits.patch b/bridge-utils-1.1-itsits.patch new file mode 100644 index 0000000..866c8e6 --- /dev/null +++ b/bridge-utils-1.1-itsits.patch @@ -0,0 +1,20 @@ +commit 13ef4638bb7b0f94120137f13d6c3b66eb6058f1 +Author: Stephen Hemminger +Date: Tue Jul 11 15:41:42 2006 -0700 + + Minor manpage typo + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296881 + +diff --git a/doc/brctl.8 b/doc/brctl.8 +index ba65a41..d904047 100644 +--- a/doc/brctl.8 ++++ b/doc/brctl.8 +@@ -72,7 +72,7 @@ will detach the interface from + + The command + .B brctl show +-will show some information on the bridge and it's attached ports. ++will show some information on the bridge and its attached ports. + + + .SH AGEING diff --git a/bridge-utils-1.1-message-2.patch b/bridge-utils-1.1-message-2.patch new file mode 100644 index 0000000..5ee0c3b --- /dev/null +++ b/bridge-utils-1.1-message-2.patch @@ -0,0 +1,49 @@ +commit cf06742ec8fd4e7ac7d393ebe093839379aa3f46 +Author: Santiago Garcia Mantinan +Date: Sat Aug 26 19:41:28 2006 +0200 + + patch for a message bug + + Hi! + + Jens Seidel reported a bug to Debian about a wrong message on brctl, you can + see it at http://bugs.debian.org/383938, it is kind of the continuation of + the ENODEV bug #348617 that was already patched by Stephen on the git. + + I have applied the same solution that Stephen applied for the first one, + follows the patch against git plus a minor exclamation mark modification I + did so that all ENODEV messages were exclamative (Stephen patch had missed + that mark). + + Regards... + -- + Manty/BestiaTester -> http://manty.net + + Signed-off-by: Stephen Hemminger + +diff --git a/brctl/brctl_cmd.c b/brctl/brctl_cmd.c +index a05d5b1..c93dd55 100644 +--- a/brctl/brctl_cmd.c ++++ b/brctl/brctl_cmd.c +@@ -99,7 +99,7 @@ static int br_cmd_addif(int argc, char * + if (if_nametoindex(ifname) == 0) + fprintf(stderr, "interface %s does not exist!\n", ifname); + else +- fprintf(stderr, "bridge %s does not exist\n", brname); ++ fprintf(stderr, "bridge %s does not exist!\n", brname); + break; + + case EBUSY: +@@ -139,8 +139,10 @@ static int br_cmd_delif(int argc, char * + continue; + + case ENODEV: +- fprintf(stderr, "interface %s does not exist!\n", +- ifname); ++ if (if_nametoindex(ifname) == 0) ++ fprintf(stderr, "interface %s does not exist!\n", ifname); ++ else ++ fprintf(stderr, "bridge %s does not exist!\n", brname); + break; + + case EINVAL: diff --git a/bridge-utils-1.1-message.patch b/bridge-utils-1.1-message.patch new file mode 100644 index 0000000..5f2d801 --- /dev/null +++ b/bridge-utils-1.1-message.patch @@ -0,0 +1,23 @@ +commit 3f28faf1a984ae611bc37ff9b9cdd21071df771b +Author: Stephen Hemminger +Date: Tue Jul 11 16:02:37 2006 -0700 + + If addif fails report whether bridge or interface doesn't exist. + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348617 + +diff --git a/brctl/brctl_cmd.c b/brctl/brctl_cmd.c +index 67aaad4..a05d5b1 100644 +--- a/brctl/brctl_cmd.c ++++ b/brctl/brctl_cmd.c +@@ -96,7 +96,10 @@ static int br_cmd_addif(int argc, char * + continue; + + case ENODEV: +- fprintf(stderr, "interface %s does not exist!\n", ifname); ++ if (if_nametoindex(ifname) == 0) ++ fprintf(stderr, "interface %s does not exist!\n", ifname); ++ else ++ fprintf(stderr, "bridge %s does not exist\n", brname); + break; + + case EBUSY: diff --git a/bridge-utils-1.1-setportprio.patch b/bridge-utils-1.1-setportprio.patch new file mode 100644 index 0000000..4618a68 --- /dev/null +++ b/bridge-utils-1.1-setportprio.patch @@ -0,0 +1,31 @@ +commit 32a43e993241ff53f3333c4533d135c4f6cead73 +Author: Stephen Hemminger +Date: Wed May 31 14:20:30 2006 -0700 + + Fix bug where changing port priority changed path cost instead. + +diff --git a/ChangeLog b/ChangeLog +index e31da93..435d2f5 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,7 @@ ++2006-05-31 Stephen Hemminger ++ ++ * Fixed bug where setting port priority set path cost instead ++ + 2006-01-31 Stephen Hemminger + + * Released bridge-utils 1.1 +diff --git a/brctl/brctl_cmd.c b/brctl/brctl_cmd.c +index 6d0785e..67aaad4 100644 +--- a/brctl/brctl_cmd.c ++++ b/brctl/brctl_cmd.c +@@ -267,7 +267,7 @@ static int br_cmd_setportprio(int argc, + return 1; + } + +- err = br_set_path_cost(argv[1], argv[2], cost); ++ err = br_set_port_priority(argv[1], argv[2], cost); + if (err) + fprintf(stderr, "set port priority failed: %s\n", + strerror(errno)); diff --git a/bridge-utils-1.1-sysfs-close.patch b/bridge-utils-1.1-sysfs-close.patch new file mode 100644 index 0000000..c1fd05f --- /dev/null +++ b/bridge-utils-1.1-sysfs-close.patch @@ -0,0 +1,133 @@ +commit 4d480f55ae79cd3b3d1b2681a852e8317a23c977 +Author: Marco Nenciarini +Date: Tue Jul 11 16:08:40 2006 -0700 + + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=376914 + + some libsysfs2 internal stucts are corrupted during execution of brctl + by unneeded and erroneous calls to sysfs_close_class_device() + + Long description of my troubles + + On my xen Dom0 with 5 bridges and many interfaces every brctl show + invocations fails with a strange error. + + bridge name bridge id STP enabled interfaces + xenbr0 8000.feffffffffff no vif1.0 + peth0 + vif0.0 + xenbr1 8000.feffffffffff no vif3.0 + vif2.0 + vif1.1 + peth1 + vif0.1 + xenbr2 8000.feffffffffff no vif1.2 + peth2 + vif0.2 + xenbr3 8000.feffffffffff no can't get port info: No such device + xenbr4 8000.feffffffffff no vif2.2 + peth4 + vif0.4 + + but xenbr3 was fully up and functional, as stated by the contents of + /sys/class/net/xenbr3 directory. + + Investigating with strace i've found that brctl give this error + because it is trying to read xenbr3 interfaces in + /sys/class/net/eth0/brif directory! + + ..... + lstat64("/sys/class/net/xenbr3/bridge/topology_change_detected", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0 + stat64("/sys/class/net/xenbr3/bridge/topology_change_detected", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0 + open("/sys/class/net/xenbr3/bridge/topology_change_detected", O_RDONLY) = 4 + read(4, "0\n", 4096) = 2 + close(4) = 0 + open("/sys/class/net/eth0/brif", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = -1 ENOENT (No such file or directory) + ioctl(3, SIOCDEVPRIVATE, 0xafdec36c) = -1 ENODEV (No such device) + write(1, "8000.feffffffffff\tno\t\t can\'t get"..., 59) = 59 + lstat64("/sys/class/net/xenbr4/bridge", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 + write(1, "xenbr4\t\t", 8) = 8 + ..... + + after some gdb and documentation reading sessions i've discovered that + all calls to sysfs_close_class_device() in libbridge code are wrong, + because their arguments are pointers returned by sysfs_get_* + functions. This is explicitly forbidden by libsysfs documentation[1] + at 6.1.b and corrupt libsysfs internal structures freeing memory that + still being used. + + [1] /usr/share/doc/libsysfs-dev/libsysfs.txt.gz + + ..... + 6.1 Calling Conventions in Libsysfs + ----------------------------------- + + Libsysfs uses a simple API calling convention. APIs are classified to be + one of "open", "get", "close" types. The convention is as follows: + + a. All "open" APIs have a corresponding "close" API. + b. References obtained using "get" calls should not be closed + explicitly. + c. All "opened" references have to be closed with a call to + their corresponding "close" call. This takes care of + freeing structure references obtained with "get" calls. + ..... + + I have checked all other sysfs_close_* calls and they seem to be + correct. + + Attached patch removes the wrong call, so i can operate correctly on + my bridges. + +diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c +index d3052a1..3703f4b 100644 +--- a/libbridge/libbridge_devif.c ++++ b/libbridge/libbridge_devif.c +@@ -188,7 +188,6 @@ #ifdef HAVE_LIBSYSFS + snprintf(path, SYSFS_PATH_MAX, "%s/bridge", dev->path); + if (sysfs_path_is_dir(path)) { + dprintf("path '%s' is not a directory\n", path); +- sysfs_close_class_device(dev); + goto fallback; + } + +@@ -214,7 +213,6 @@ #ifdef HAVE_LIBSYSFS + info->topology_change = fetch_int(dev, BRIDGEATTR("topology_change")); + info->topology_change_detected = fetch_int(dev, + BRIDGEATTR("topology_change_detected")); +- sysfs_close_class_device(dev); + + return 0; + +@@ -287,7 +285,6 @@ #ifdef HAVE_LIBSYSFS + + snprintf(path, SYSFS_PATH_MAX, "%s/brport", dev->path); + if (sysfs_path_is_dir(path)) { +- sysfs_close_class_device(dev); + goto fallback; + } + +@@ -309,7 +306,6 @@ #ifdef HAVE_LIBSYSFS + &info->forward_delay_timer_value); + fetch_tv(dev, BRPORT("hold_timer"), + &info->hold_timer_value); +- sysfs_close_class_device(dev); + + return 0; + fallback: +@@ -339,7 +335,6 @@ #ifdef HAVE_LIBSYSFS + ret = sysfs_write_attribute(attr, buf, strlen(buf)); + sysfs_close_attribute(attr); + } +- sysfs_close_class_device(dev); + } else + #endif + { +@@ -411,7 +406,6 @@ #ifdef HAVE_LIBSYSFS + ret = sysfs_write_attribute(attr, buf, strlen(buf)); + sysfs_close_attribute(attr); + } +- sysfs_close_class_device(dev); + } else + #endif + { diff --git a/bridge-utils.spec b/bridge-utils.spec index 3289345..519aeb3 100644 --- a/bridge-utils.spec +++ b/bridge-utils.spec @@ -1,12 +1,18 @@ Summary: Utilities for configuring the linux ethernet bridge Name: bridge-utils Version: 1.1 -Release: 1.1 +Release: 2 License: GPL URL: http://bridge.sourceforge.net/ Group: System Environment/Base Source: http://dl.sf.net/bridge/bridge-utils-%{version}.tar.gz Patch0: bridge-utils-1.0.4-inc.patch +Patch1: bridge-utils-1.1-setportprio.patch +Patch2: bridge-utils-1.1-itsits.patch +Patch3: bridge-utils-1.1-message.patch +Patch4: bridge-utils-1.1-sysfs-close.patch +Patch5: bridge-utils-1.1-message-2.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: libsysfs-devel BuildRequires: kernel-headers >= 2.6.16 @@ -24,6 +30,11 @@ Install bridge-utils if you want to use the linux ethernet bridge. %setup %patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build %configure @@ -42,6 +53,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/brctl.8* %changelog +* Sat Sep 09 2006 David Woodhouse 1.1-2 +- Fix setportprio command (#205810) +- Other updates from bridge-utils git tree + * Wed Jul 12 2006 Jesse Keating - 1.1-1.1 - rebuild