Hello community,
here is the log from the commit of package bridge-utils
checked in at Thu Jul 27 17:54:36 CEST 2006.
--------
--- bridge-utils/bridge-utils.changes 2006-01-25 21:34:45.000000000 +0100
+++ bridge-utils/bridge-utils.changes 2006-07-27 16:30:07.000000000 +0200
@@ -1,0 +2,6 @@
+Thu Jul 27 15:32:52 CEST 2006 - mjancar@suse.cz
+
+- update to 1.1
+ * Change to use libsysfs 2.0
+
+-------------------------------------------------------------------
Old:
----
bridge-utils-1.0.6.tar.bz2
New:
----
bridge-utils-1.1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ bridge-utils.spec ++++++
--- /var/tmp/diff_new_pack.FZw8db/_old 2006-07-27 17:53:51.000000000 +0200
+++ /var/tmp/diff_new_pack.FZw8db/_new 2006-07-27 17:53:51.000000000 +0200
@@ -1,22 +1,23 @@
#
-# spec file for package bridge-utils (Version 1.0.6)
+# spec file for package bridge-utils (Version 1.1)
#
-# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
-# Please submit bugfixes or comments via http://www.suse.de/feedback/
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: bridge-utils
-Version: 1.0.6
-Release: 3
+BuildRequires: libsysfs
+Version: 1.1
+Release: 1
Autoreqprov: on
Group: Productivity/Networking/Routing
License: GPL
-URL: http://bridge.sourceforge.net
+URL: http://linux-net.osdl.org/index.php/Bridge
Summary: Utilities for Configuring the Linux Ethernet Bridge
Source: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -24,7 +25,7 @@
%description
This package contains utilities for configuring the Linux ethernet
bridge. The Linux ethernet bridge can be used for connecting multiple
-ethernet devices together. The connecting is fully transparent: hosts
+ethernet devices together. The connection is fully transparent: hosts
connected to one ethernet device see hosts connected to the other
ethernet devices directly.
@@ -65,6 +66,9 @@
/sbin/*
%changelog -n bridge-utils
+* Thu Jul 27 2006 - mjancar@suse.cz
+- update to 1.1
+ * Change to use libsysfs 2.0
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Oct 05 2005 - dmueller@suse.de
++++++ bridge-utils-1.0.6.tar.bz2 -> bridge-utils-1.1.tar.bz2 ++++++
++++ 1672 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/bridge-utils-1.0.6/ChangeLog new/bridge-utils-1.1/ChangeLog
--- old/bridge-utils-1.0.6/ChangeLog 2005-03-16 20:18:32.000000000 +0100
+++ new/bridge-utils-1.1/ChangeLog 2006-01-31 20:33:58.000000000 +0100
@@ -1,3 +1,8 @@
+2006-01-31 Stephen Hemminger
+
+ * Released bridge-utils 1.1
+ * Change to use libsysfs 2.0
+
2005-03-16 Stephen Hemminger
* Released bridge-utils 1.0.6
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/bridge-utils-1.0.6/configure.in new/bridge-utils-1.1/configure.in
--- old/bridge-utils-1.0.6/configure.in 2005-03-16 21:15:46.000000000 +0100
+++ new/bridge-utils-1.1/configure.in 2006-01-31 20:46:44.000000000 +0100
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(brctl/brctl.c)
-AC_CONFIG_HEADER(libbridge/config.h)
-AM_INIT_AUTOMAKE(bridge-utils,1.0.6)
+AC_INIT(bridge-utils, 1.1)
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS(libbridge/config.h)
AC_ARG_WITH( linux-headers, [ --with-linux-headers Location of the linux headers to use],
KERNEL_HEADERS=$withval, KERNEL_HEADERS="/usr/src/linux/include")
@@ -27,7 +27,7 @@
dnl Check for libsysfs
AC_CHECK_HEADER(sysfs/libsysfs.h,
- [AC_CHECK_LIB(sysfs, sysfs_open_directory,
+ [AC_CHECK_LIB(sysfs, sysfs_open_directory_list,
[AC_DEFINE(HAVE_LIBSYSFS)
LIBS="$LIBS -lsysfs"],
[AC_MSG_WARN([Missing sysfs library!])])],
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/bridge-utils-1.0.6/libbridge/libbridge_devif.c new/bridge-utils-1.1/libbridge/libbridge_devif.c
--- old/bridge-utils-1.0.6/libbridge/libbridge_devif.c 2004-06-08 17:57:49.000000000 +0200
+++ new/bridge-utils-1.1/libbridge/libbridge_devif.c 2006-02-01 18:58:00.000000000 +0100
@@ -35,43 +35,17 @@
return strtoul(t, NULL, 16);
}
-static struct sysfs_directory *bridge_sysfs_directory(const char *devname,
- const char *subname)
-{
- struct sysfs_directory *sdir;
- struct sysfs_class_device *dev;
- char path[SYSFS_PATH_MAX];
-
- if (!devname)
- return NULL;
+#define BRIDGEATTR(_a) SYSFS_BRIDGE_ATTR "/" _a
+#define BRPORT(_a) SYSFS_BRIDGE_PORT_ATTR "/" _a
- if (!br_class_net) {
- dprintf("can't find class_net\n");
- return NULL;
- }
-
- dev = sysfs_get_class_device(br_class_net, (char *) devname);
- if (!dev) {
- dprintf("can't find device %s in %s\n", devname, br_class_net->path);
- return NULL;
- }
-
- snprintf(path, SYSFS_PATH_MAX, "%s/%s", dev->path, subname);
- sdir = sysfs_open_directory(path);
- if (!sdir)
- dprintf("can't open directory: %s\n", path);
- return sdir;
-}
-
-static void fetch_id(struct sysfs_directory *sdir, const char *name,
- struct bridge_id *id)
+static void fetch_id(struct sysfs_class_device *dev,
+ const char *name, struct bridge_id *id)
{
struct sysfs_attribute *attr;
-
- memset(id, 0, sizeof(id));
- attr = sysfs_get_directory_attribute(sdir, (char *) name);
+
+ attr = sysfs_get_classdev_attr(dev, name);
if (!attr) {
- dprintf("Can't find attribute %s/%s\n", sdir->path, name);
+ dprintf("Can't find attribute %s/%s\n", dev->path, name);
return;
}
@@ -91,33 +65,25 @@
}
/* Get a time value out of sysfs */
-static void fetch_tv(struct sysfs_directory *sdir, const char *name,
+static void fetch_tv(struct sysfs_class_device *dev,
+ const char *name,
struct timeval *tv)
{
- struct sysfs_attribute *attr
- = sysfs_get_directory_attribute(sdir, (char *) name);
+ struct sysfs_attribute *attr;
- if (!attr) {
- dprintf("Can't find attribute %s/%s\n", sdir->path, name);
- memset(tv, 0, sizeof(tv));
- return;
- }
+ attr = sysfs_get_classdev_attr(dev, name);
+ if (attr)
+ __jiffies_to_tv(tv, strtoul(attr->value, NULL, 0));
- __jiffies_to_tv(tv, strtoul(attr->value, NULL, 0));
}
/* Fetch an integer attribute out of sysfs. */
-static int fetch_int(struct sysfs_directory *sdir, const char *name)
+static int fetch_int(struct sysfs_class_device *dev, const char *name)
{
- struct sysfs_attribute *attr
- = sysfs_get_directory_attribute(sdir, (char *) name);
- int val = 0;
-
- if (!attr)
- dprintf("Can't find attribute %s/%s\n", sdir->path, name);
- else
- val = strtol(attr->value, NULL, 0);
- return val;
+ struct sysfs_attribute *attr;
+
+ attr = sysfs_get_classdev_attr(dev, name);
+ return attr ? strtol(attr->value, NULL, 0) : 0;
}
#endif
@@ -206,40 +172,55 @@
*/
int br_get_bridge_info(const char *bridge, struct bridge_info *info)
{
-#ifndef HAVE_LIBSYSFS
- return old_get_bridge_info(bridge, info);
-#else
- struct sysfs_directory *sdir;
+#ifdef HAVE_LIBSYSFS
+ struct sysfs_class_device *dev;
+ char path[SYSFS_PATH_MAX];
- sdir = bridge_sysfs_directory(bridge, SYSFS_BRIDGE_ATTR);
- if (!sdir)
- return old_get_bridge_info(bridge,info);
+ if (!br_class_net)
+ goto fallback;
+
+ dev = sysfs_get_class_device(br_class_net, bridge);
+ if (!dev) {
+ dprintf("get_class_device '%s' failed\n", bridge);
+ goto fallback;
+ }
+
+ 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;
+ }
memset(info, 0, sizeof(*info));
- fetch_id(sdir, "root_id", &info->designated_root);
- fetch_id(sdir, "bridge_id", &info->bridge_id);
- info->root_path_cost = fetch_int(sdir, "root_path_cost");
- fetch_tv(sdir, "max_age", &info->max_age);
- fetch_tv(sdir, "hello_time", &info->hello_time);
- fetch_tv(sdir, "forward_delay", &info->forward_delay);
- fetch_tv(sdir, "max_age", &info->bridge_max_age);
- fetch_tv(sdir, "hello_time", &info->bridge_hello_time);
- fetch_tv(sdir, "forward_delay", &info->bridge_forward_delay);
- fetch_tv(sdir, "ageing_time", &info->ageing_time);
- fetch_tv(sdir, "hello_timer", &info->hello_timer_value);
- fetch_tv(sdir, "tcn_timer", &info->tcn_timer_value);
- fetch_tv(sdir, "topology_change_timer",
+ fetch_id(dev, BRIDGEATTR("root_id"), &info->designated_root);
+ fetch_id(dev, BRIDGEATTR("bridge_id"), &info->bridge_id);
+ info->root_path_cost = fetch_int(dev, BRIDGEATTR("root_path_cost"));
+ fetch_tv(dev, BRIDGEATTR("max_age"), &info->max_age);
+ fetch_tv(dev, BRIDGEATTR("hello_time"), &info->hello_time);
+ fetch_tv(dev, BRIDGEATTR("forward_delay"), &info->forward_delay);
+ fetch_tv(dev, BRIDGEATTR("max_age"), &info->bridge_max_age);
+ fetch_tv(dev, BRIDGEATTR("hello_time"), &info->bridge_hello_time);
+ fetch_tv(dev, BRIDGEATTR("forward_delay"), &info->bridge_forward_delay);
+ fetch_tv(dev, BRIDGEATTR("ageing_time"), &info->ageing_time);
+ fetch_tv(dev, BRIDGEATTR("hello_timer"), &info->hello_timer_value);
+ fetch_tv(dev, BRIDGEATTR("tcn_timer"), &info->tcn_timer_value);
+ fetch_tv(dev, BRIDGEATTR("topology_change_timer"),
&info->topology_change_timer_value);;
- fetch_tv(sdir, "gc_timer", &info->gc_timer_value);
+ fetch_tv(dev, BRIDGEATTR("gc_timer"), &info->gc_timer_value);
- info->root_port = fetch_int(sdir, "root_port");
- info->stp_enabled = fetch_int(sdir, "stp_state");
- info->topology_change = fetch_int(sdir, "topology_change");
- info->topology_change_detected = fetch_int(sdir, "topology_change_detected");
- sysfs_close_directory(sdir);
+ info->root_port = fetch_int(dev, BRIDGEATTR("root_port"));
+ info->stp_enabled = fetch_int(dev, BRIDGEATTR("stp_state"));
+ 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;
+
+fallback:
#endif
+ return old_get_bridge_info(bridge, info);
}
static int old_get_port_info(const char *brname, const char *port,
@@ -293,61 +274,73 @@
int br_get_port_info(const char *brname, const char *port,
struct port_info *info)
{
-#ifndef HAVE_LIBSYSFS
- return old_get_port_info(brname, port, info);
-#else
- struct sysfs_directory *sdir
- = bridge_sysfs_directory(port, SYSFS_BRIDGE_PORT_ATTR);
+#ifdef HAVE_LIBSYSFS
+ struct sysfs_class_device *dev;
+ char path[SYSFS_PATH_MAX];
- if (!sdir)
- return old_get_port_info(brname, port, info);
+ if (!br_class_net)
+ goto fallback;
+
+ dev = sysfs_get_class_device(br_class_net, port);
+ if (!dev)
+ goto fallback;
+
+ snprintf(path, SYSFS_PATH_MAX, "%s/brport", dev->path);
+ if (sysfs_path_is_dir(path)) {
+ sysfs_close_class_device(dev);
+ goto fallback;
+ }
memset(info, 0, sizeof(*info));
- fetch_id(sdir, "designated_root", &info->designated_root);
- fetch_id(sdir, "designated_bridge", &info->designated_bridge);
- info->port_no = fetch_int(sdir, "port_no");
- info->port_id = fetch_int(sdir, "port_id");
- info->designated_port = fetch_int(sdir, "designated_port");
- info->path_cost = fetch_int(sdir, "path_cost");
- info->designated_cost = fetch_int(sdir, "designated_cost");
- info->state = fetch_int(sdir, "state");
- info->top_change_ack = fetch_int(sdir, "change_ack");
- info->config_pending = fetch_int(sdir, "config_pending");
- fetch_tv(sdir, "message_age_timer",
+
+ fetch_id(dev, BRPORT("designated_root"), &info->designated_root);
+ fetch_id(dev, BRPORT("designated_bridge"), &info->designated_bridge);
+ info->port_no = fetch_int(dev, BRPORT("port_no"));
+ info->port_id = fetch_int(dev, BRPORT("port_id"));
+ info->designated_port = fetch_int(dev, BRPORT("designated_port"));
+ info->path_cost = fetch_int(dev, BRPORT("path_cost"));
+ info->designated_cost = fetch_int(dev, BRPORT("designated_cost"));
+ info->state = fetch_int(dev, BRPORT("state"));
+ info->top_change_ack = fetch_int(dev, BRPORT("change_ack"));
+ info->config_pending = fetch_int(dev, BRPORT("config_pending"));
+ fetch_tv(dev, BRPORT("message_age_timer"),
&info->message_age_timer_value);
- fetch_tv(sdir, "forward_delay_timer",
+ fetch_tv(dev, BRPORT("forward_delay_timer"),
&info->forward_delay_timer_value);
- fetch_tv(sdir, "hold_timer",
+ fetch_tv(dev, BRPORT("hold_timer"),
&info->hold_timer_value);
- sysfs_close_directory(sdir);
+ sysfs_close_class_device(dev);
return 0;
+fallback:
#endif
+ return old_get_port_info(brname, port, info);
}
static int br_set(const char *bridge, const char *name,
unsigned long value, unsigned long oldcode)
{
- int ret;
+ int ret = -1;
#ifdef HAVE_LIBSYSFS
- struct sysfs_directory *sdir;
-
- sdir = bridge_sysfs_directory(bridge, SYSFS_BRIDGE_ATTR);
- if (sdir) {
+ struct sysfs_class_device *dev;
+
+ dev = sysfs_get_class_device(br_class_net, bridge);
+ if (dev) {
struct sysfs_attribute *attr;
char buf[32];
- sprintf(buf, "%ld", value);
-
- attr = sysfs_get_directory_attribute(sdir, (char *) name);
- if (attr)
+ char path[SYSFS_PATH_MAX];
+
+ snprintf(buf, sizeof(buf), "%ld\n", value);
+ snprintf(path, SYSFS_PATH_MAX, "%s/bridge/%s", dev->path, name);
+
+ attr = sysfs_open_attribute(path);
+ if (attr) {
ret = sysfs_write_attribute(attr, buf, strlen(buf));
- else {
- ret = -1;
- errno = EINVAL;
+ sysfs_close_attribute(attr);
}
- sysfs_close_directory(sdir);
- } else
+ sysfs_close_class_device(dev);
+ } else
#endif
{
struct ifreq ifr;
@@ -400,37 +393,40 @@
const char *name, unsigned long value,
unsigned long oldcode)
{
- int ret, index;
+ int ret = -1;
#ifdef HAVE_LIBSYSFS
- struct sysfs_directory *sdir;
+ struct sysfs_class_device *dev;
- sdir = bridge_sysfs_directory(ifname, SYSFS_BRIDGE_PORT_ATTR);
- if (sdir) {
+ dev = sysfs_get_class_device(br_class_net, ifname);
+ if (dev) {
struct sysfs_attribute *attr;
+ char path[SYSFS_PATH_MAX];
char buf[32];
sprintf(buf, "%ld", value);
+ snprintf(path, SYSFS_PATH_MAX, "%s/brport/%s", dev->path, name);
- attr = sysfs_get_directory_attribute(sdir, (char *) name);
- if (attr)
+ attr = sysfs_open_attribute(path);
+ if (attr) {
ret = sysfs_write_attribute(attr, buf, strlen(buf));
- else {
- ret = -1;
- errno = EINVAL;
+ sysfs_close_attribute(attr);
}
- sysfs_close_directory(sdir);
+ sysfs_close_class_device(dev);
} else
#endif
- if ( (index = get_portno(bridge, ifname)) < 0)
- ret = index;
-
- else {
- struct ifreq ifr;
- unsigned long args[4] = { oldcode, index, value, 0 };
+ {
+ int index = get_portno(bridge, ifname);
- strncpy(ifr.ifr_name, bridge, IFNAMSIZ);
- ifr.ifr_data = (char *) &args;
- ret = ioctl(br_socket_fd, SIOCDEVPRIVATE, &ifr);
+ if (index < 0)
+ ret = index;
+ else {
+ struct ifreq ifr;
+ unsigned long args[4] = { oldcode, index, value, 0 };
+
+ strncpy(ifr.ifr_name, bridge, IFNAMSIZ);
+ ifr.ifr_data = (char *) &args;
+ ret = ioctl(br_socket_fd, SIOCDEVPRIVATE, &ifr);
+ }
}
return ret < 0 ? errno : 0;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/bridge-utils-1.0.6/libbridge/libbridge_init.c new/bridge-utils-1.1/libbridge/libbridge_init.c
--- old/bridge-utils-1.0.6/libbridge/libbridge_init.c 2004-06-04 20:03:42.000000000 +0200
+++ new/bridge-utils-1.1/libbridge/libbridge_init.c 2006-02-01 18:58:00.000000000 +0100
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include "libbridge.h"
#include "libbridge_private.h"
@@ -206,9 +207,8 @@
{
#ifdef HAVE_LIBSYSFS
struct sysfs_class_device *dev;
- struct sysfs_directory *dir;
- struct sysfs_link *plink;
- struct dlist *links;
+ DIR *dir;
+ struct dirent *dirent;
int err = 0;
char path[SYSFS_PATH_MAX];
@@ -219,8 +219,8 @@
snprintf(path, sizeof(path), "%s/%s",
dev->path, SYSFS_BRIDGE_PORT_SUBDIR);
- dprintf("path=%s\n", path);
- dir = sysfs_open_directory(path);
+
+ dir = opendir(path);
if (!dir) {
/* no /sys/class/net/ethX/brif subdirectory
* either: old kernel, or not really a bridge
@@ -228,20 +228,18 @@
goto old;
}
- links = sysfs_get_dir_links(dir);
- if (!links) {
- err = -ENOSYS;
- goto out;
- }
-
err = 0;
- dlist_for_each_data(links, plink, struct sysfs_link) {
+ while ((dirent = readdir(dir)) != NULL) {
+ if (0 == strcmp(dirent->d_name, "."))
+ continue;
+ if (0 == strcmp(dirent->d_name, ".."))
+ continue;
++err;
- if (iterator(brname, plink->name, arg))
+ if (iterator(brname, dirent->d_name, arg))
break;
}
- out:
- sysfs_close_directory(dir);
+ closedir(dir);
+
return err;
old:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit-unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit-help@opensuse.org