[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1r6l4avhp.fsf_-_@ebiederm.dsl.xmission.com>
Date: Wed, 12 Sep 2007 07:01:06 -0600
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Stephen Hemminger <shemminger@...ux-foundation.org>
Cc: <netdev@...r.kernel.org>, Pavel Emelyanov <xemul@...nvz.org>,
Patrick McHardy <kaber@...sh.net>
Subject: [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes.
From: Eric W. Biederman <ebiederm@...ssion.com>
Date: Sat, 8 Sep 2007 10:17:43 -0600
This patch contains small compile and implementation
bug fixes for link_veth.c.
The compile fixes stop trying to build a shared object
when we can just as easily compile the code in. Making
support of non arch/i386 architectures easier.
The documentation is fixed to not document the previous version
of the veth support.
The code is to initialize it's pointers before calling
iplink_parse, and we now set name = dev if name is not
passed.
Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
---
ip/Makefile | 8 +++-----
ip/link_veth.c | 12 +++++++++---
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/ip/Makefile b/ip/Makefile
index b46bce3..a98e1f3 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -3,14 +3,15 @@ IPOBJ=ip.o ipaddress.o iproute.o iprule.o \
ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o
+IPOBJ += link_veth.o
+
RTMONOBJ=rtmon.o
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
SCRIPTS=ifcfg rtpr routel routef
TARGETS=ip rtmon
-LIBS=link_veth.so
-all: $(TARGETS) $(SCRIPTS) $(LIBS)
+all: $(TARGETS) $(SCRIPTS)
ip: $(IPOBJ) $(LIBNETLINK) $(LIBUTIL)
@@ -25,6 +26,3 @@ clean:
LDLIBS += -ldl
LDFLAGS += -Wl,-export-dynamic
-
-%.so: %.c
- $(CC) $(CFLAGS) -shared $< -o $@
diff --git a/ip/link_veth.c b/ip/link_veth.c
index ded2cdd..6f3931c 100644
--- a/ip/link_veth.c
+++ b/ip/link_veth.c
@@ -20,14 +20,16 @@
static void usage(void)
{
- printf("Usage: ip link add ... type veth "
- "[peer <peer-name>] [mac <mac>] [peer_mac <mac>]\n");
+ printf("Usage: ip link add ... type veth peer { ... }\n");
}
static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *hdr)
{
- char *name, *type, *link, *dev;
+ char *dev = NULL;
+ char *name = NULL;
+ char *link = NULL;
+ char *type = NULL;
int err, len;
struct rtattr * data;
@@ -46,6 +48,10 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
if (err < 0)
return err;
+ /* Allow "ip link add dev" and "ip link add name" */
+ if (!name)
+ name = dev;
+
if (name) {
len = strlen(name) + 1;
if (len > IFNAMSIZ)
--
1.5.3.rc6.17.g1911
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists