netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware"
@ 2007-09-12 12:55 Eric W. Biederman
  2007-09-12 12:55 ` Pavel Emelyanov
  2007-09-12 12:58 ` [PATCH 2/6] [IPROUTE2] Introduce iplink_parse() routine Eric W. Biederman
  0 siblings, 2 replies; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 12:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy


Stephen it looks like you weren't cc'd on the latest version
of the veth support.  So this patchset first reverts the old
version of the veth support you merged.  Then merges a tested
version of the veth support.

This reverts commit 4ed390ce43d1ec7c881721f312260df901d8390d.

Conflicts:

	ip/ip.c
---
 ip/Makefile |    2 +-
 ip/ip.c     |    4 +-
 ip/veth.c   |  196 -----------------------------------------------------------
 ip/veth.h   |   17 -----
 4 files changed, 2 insertions(+), 217 deletions(-)
 delete mode 100644 ip/veth.c
 delete mode 100644 ip/veth.h

diff --git a/ip/Makefile b/ip/Makefile
index 209c5c8..9a5bfe3 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -1,7 +1,7 @@
 IPOBJ=ip.o ipaddress.o iproute.o iprule.o \
     rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
     ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
-    ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o veth.o
+    ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o
 
 RTMONOBJ=rtmon.o
 
diff --git a/ip/ip.c b/ip/ip.c
index 829fc64..4bdb83b 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -27,7 +27,6 @@
 #include "SNAPSHOT.h"
 #include "utils.h"
 #include "ip_common.h"
-#include "veth.h"
 
 int preferred_family = AF_UNSPEC;
 int show_stats = 0;
@@ -48,7 +47,7 @@ static void usage(void)
 "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
 "       ip [ -force ] [-batch filename\n"
 "where  OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n"
-"                   maddr | mroute | monitor | xfrm | veth }\n"
+"                   maddr | mroute | monitor | xfrm }\n"
 "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
 "                    -f[amily] { inet | inet6 | ipx | dnet | link } |\n"
 "                    -o[neline] | -t[imestamp] }\n");
@@ -78,7 +77,6 @@ static const struct cmd {
 	{ "monitor",	do_ipmonitor },
 	{ "xfrm",	do_xfrm },
 	{ "mroute",	do_multiroute },
-	{ "veth",	do_veth },
 	{ "help",	do_help },
 	{ 0 }
 };
diff --git a/ip/veth.c b/ip/veth.c
deleted file mode 100644
index d4eecc8..0000000
--- a/ip/veth.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * veth.c	       "ethernet tunnel"
- *
- *		This program is free software; you can redistribute it and/or
- *		modify it under the terms of the GNU General Public License
- *		as published by the Free Software Foundation; either version
- *		2 of the License, or (at your option) any later version.
- *
- * Authors:	Pavel Emelianov, <xemul@openvz.org>
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <linux/genetlink.h>
-
-#include "utils.h"
-#include "veth.h"
-
-#define GENLMSG_DATA(glh)       ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
-#define NLA_DATA(na)            ((void *)((char*)(na) + NLA_HDRLEN))
-
-static int do_veth_help(void)
-{
-	fprintf(stderr, "Usage: ip veth add DEVICE PEER_NAME\n");
-	fprintf(stderr, "               del DEVICE\n");
-	exit(-1);
-}
-
-static int genl_ctrl_resolve_family(const char *family)
-{
-	struct rtnl_handle rth;
-	struct nlmsghdr *nlh;
-	struct genlmsghdr *ghdr;
-	int ret = 0;
-	struct {
-		struct nlmsghdr         n;
-		char                    buf[4096];
-	} req;
-
-	memset(&req, 0, sizeof(req));
-
-	nlh = &req.n;
-	nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
-	nlh->nlmsg_type = GENL_ID_CTRL;
-
-	ghdr = NLMSG_DATA(&req.n);
-	ghdr->cmd = CTRL_CMD_GETFAMILY;
-
-	if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0) {
-		fprintf(stderr, "Cannot open generic netlink socket\n");
-		exit(1);
-	}
-
-	addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1);
-
-	if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL) < 0) {
-		fprintf(stderr, "Error talking to the kernel\n");
-		goto errout;
-	}
-
-	{
-		struct rtattr *tb[CTRL_ATTR_MAX + 1];
-		struct genlmsghdr *ghdr = NLMSG_DATA(nlh);
-		int len = nlh->nlmsg_len;
-		struct rtattr *attrs;
-
-		if (nlh->nlmsg_type !=  GENL_ID_CTRL) {
-			fprintf(stderr, "Not a controller message, nlmsg_len=%d "
-				"nlmsg_type=0x%x\n", nlh->nlmsg_len, nlh->nlmsg_type);
-			goto errout;
-		}
-
-		if (ghdr->cmd != CTRL_CMD_NEWFAMILY) {
-			fprintf(stderr, "Unkown controller command %d\n", ghdr->cmd);
-			goto errout;
-		}
-
-		len -= NLMSG_LENGTH(GENL_HDRLEN);
-
-		if (len < 0) {
-			fprintf(stderr, "wrong controller message len %d\n", len);
-			return -1;
-		}
-
-		attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN);
-		parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len);
-
-		if (tb[CTRL_ATTR_FAMILY_ID] == NULL) {
-			fprintf(stderr, "Missing family id TLV\n");
-			goto errout;
-		}
-
-		ret = *(__u16 *) RTA_DATA(tb[CTRL_ATTR_FAMILY_ID]);
-	}
-
-errout:
-	rtnl_close(&rth);
-	return ret;
-}
-
-static int do_veth_operate(char *dev, char *peer, int cmd)
-{
-	struct rtnl_handle rth;
-	struct nlmsghdr *nlh;
-	struct genlmsghdr *ghdr;
-	struct nlattr *attr;
-	struct  {
-		struct nlmsghdr n;
-		struct genlmsghdr h;
-		char bug[1024];
-	} req;
-	int family, len;
-	int err = 0;
-
-	family = genl_ctrl_resolve_family("veth");
-	if (family == 0) {
-		fprintf(stderr, "veth: Can't resolve family\n");
-		exit(1);
-	}
-
-	if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0)
-		exit(1);
-
-	nlh = &req.n;
-	nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	nlh->nlmsg_flags = NLM_F_REQUEST;
-	nlh->nlmsg_type = family;
-	nlh->nlmsg_seq = 0;
-
-	ghdr = &req.h;
-	ghdr->cmd = cmd;
-
-	attr = (struct nlattr *) GENLMSG_DATA(&req);
-	len = strlen(dev);
-	attr->nla_type = VETH_ATTR_DEVNAME;
-	attr->nla_len = len + 1 + NLA_HDRLEN;
-	memcpy(NLA_DATA(attr), dev, len);
-	nlh->nlmsg_len += NLMSG_ALIGN(attr->nla_len);
-
-	if (peer) {
-		attr = (struct nlattr *)((char *)attr +
-				NLMSG_ALIGN(attr->nla_len));
-		len = strlen(peer);
-		attr->nla_type = VETH_ATTR_PEERNAME;
-		attr->nla_len = len + 1 + NLA_HDRLEN;
-		memcpy(NLA_DATA(attr), peer, len);
-		nlh->nlmsg_len += NLMSG_ALIGN(attr->nla_len);
-	}
-
-	if (rtnl_send(&rth, (char *) &req, nlh->nlmsg_len) < 0) {
-		err = -1;
-		fprintf(stderr, "Error talking to the kernel (add)\n");
-	}
-
-	rtnl_close(&rth);
-	return err;
-}
-
-static int do_veth_add(int argc, char **argv)
-{
-	if (argc < 2)
-		return do_veth_help();
-
-	return do_veth_operate(argv[0], argv[1], VETH_CMD_ADD);
-}
-
-static int do_veth_del(int argc, char **argv)
-{
-	char *name;
-
-	if (argc < 1)
-		return do_veth_help();
-
-	return do_veth_operate(argv[0], NULL, VETH_CMD_DEL);
-}
-
-int do_veth(int argc, char **argv)
-{
-	if (argc == 0)
-		return do_veth_help();
-
-	if (strcmp(*argv, "add") == 0 || strcmp(*argv, "a") == 0)
-		return do_veth_add(argc - 1, argv + 1);
-	if (strcmp(*argv, "del") == 0 || strcmp(*argv, "d") == 0)
-		return do_veth_del(argc - 1, argv + 1);
-	if (strcmp(*argv, "help") == 0)
-		return do_veth_help();
-
-	fprintf(stderr, "Command \"%s\" is unknown, try \"ip veth help\".\n", *argv);
-	exit(-1);
-}
diff --git a/ip/veth.h b/ip/veth.h
deleted file mode 100644
index 4d7b357..0000000
--- a/ip/veth.h
+++ /dev/null
@@ -1,17 +0,0 @@
-int do_veth(int argc, char **argv);
-
-enum {
-	VETH_CMD_UNSPEC, 
-	VETH_CMD_ADD, 
-	VETH_CMD_DEL,
-
-	VETH_CMD_MAX
-};
-
-enum {
-	VETH_ATTR_UNSPEC,
-	VETH_ATTR_DEVNAME,
-	VETH_ATTR_PEERNAME,
-
-	VETH_ATTR_MAX
-};
-- 
1.5.3.rc6.17.g1911


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware"
  2007-09-12 12:55 [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware" Eric W. Biederman
@ 2007-09-12 12:55 ` Pavel Emelyanov
  2007-09-12 13:09   ` Eric W. Biederman
  2007-09-12 12:58 ` [PATCH 2/6] [IPROUTE2] Introduce iplink_parse() routine Eric W. Biederman
  1 sibling, 1 reply; 15+ messages in thread
From: Pavel Emelyanov @ 2007-09-12 12:55 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Stephen Hemminger, netdev, Patrick McHardy

Eric W. Biederman wrote:
> Stephen it looks like you weren't cc'd on the latest version
> of the veth support.  So this patchset first reverts the old

He was. The latest version looks completely different from what
is reversed in this patch.

> version of the veth support you merged.  Then merges a tested
> version of the veth support.
> 
> This reverts commit 4ed390ce43d1ec7c881721f312260df901d8390d.
> 
> Conflicts:
> 
> 	ip/ip.c
> ---
>  ip/Makefile |    2 +-
>  ip/ip.c     |    4 +-
>  ip/veth.c   |  196 -----------------------------------------------------------
>  ip/veth.h   |   17 -----
>  4 files changed, 2 insertions(+), 217 deletions(-)
>  delete mode 100644 ip/veth.c
>  delete mode 100644 ip/veth.h
> 
> diff --git a/ip/Makefile b/ip/Makefile
> index 209c5c8..9a5bfe3 100644
> --- a/ip/Makefile
> +++ b/ip/Makefile
> @@ -1,7 +1,7 @@
>  IPOBJ=ip.o ipaddress.o iproute.o iprule.o \
>      rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
>      ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
> -    ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o veth.o
> +    ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o
>  
>  RTMONOBJ=rtmon.o
>  
> diff --git a/ip/ip.c b/ip/ip.c
> index 829fc64..4bdb83b 100644
> --- a/ip/ip.c
> +++ b/ip/ip.c
> @@ -27,7 +27,6 @@
>  #include "SNAPSHOT.h"
>  #include "utils.h"
>  #include "ip_common.h"
> -#include "veth.h"
>  
>  int preferred_family = AF_UNSPEC;
>  int show_stats = 0;
> @@ -48,7 +47,7 @@ static void usage(void)
>  "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
>  "       ip [ -force ] [-batch filename\n"
>  "where  OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n"
> -"                   maddr | mroute | monitor | xfrm | veth }\n"
> +"                   maddr | mroute | monitor | xfrm }\n"
>  "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
>  "                    -f[amily] { inet | inet6 | ipx | dnet | link } |\n"
>  "                    -o[neline] | -t[imestamp] }\n");
> @@ -78,7 +77,6 @@ static const struct cmd {
>  	{ "monitor",	do_ipmonitor },
>  	{ "xfrm",	do_xfrm },
>  	{ "mroute",	do_multiroute },
> -	{ "veth",	do_veth },
>  	{ "help",	do_help },
>  	{ 0 }
>  };
> diff --git a/ip/veth.c b/ip/veth.c
> deleted file mode 100644
> index d4eecc8..0000000
> --- a/ip/veth.c
> +++ /dev/null
> @@ -1,196 +0,0 @@
> -/*
> - * veth.c	       "ethernet tunnel"
> - *
> - *		This program is free software; you can redistribute it and/or
> - *		modify it under the terms of the GNU General Public License
> - *		as published by the Free Software Foundation; either version
> - *		2 of the License, or (at your option) any later version.
> - *
> - * Authors:	Pavel Emelianov, <xemul@openvz.org>
> - *
> - */
> -
> -#include <stdio.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include <sys/types.h>
> -#include <sys/socket.h>
> -#include <linux/genetlink.h>
> -
> -#include "utils.h"
> -#include "veth.h"
> -
> -#define GENLMSG_DATA(glh)       ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
> -#define NLA_DATA(na)            ((void *)((char*)(na) + NLA_HDRLEN))
> -
> -static int do_veth_help(void)
> -{
> -	fprintf(stderr, "Usage: ip veth add DEVICE PEER_NAME\n");
> -	fprintf(stderr, "               del DEVICE\n");
> -	exit(-1);
> -}
> -
> -static int genl_ctrl_resolve_family(const char *family)
> -{
> -	struct rtnl_handle rth;
> -	struct nlmsghdr *nlh;
> -	struct genlmsghdr *ghdr;
> -	int ret = 0;
> -	struct {
> -		struct nlmsghdr         n;
> -		char                    buf[4096];
> -	} req;
> -
> -	memset(&req, 0, sizeof(req));
> -
> -	nlh = &req.n;
> -	nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
> -	nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
> -	nlh->nlmsg_type = GENL_ID_CTRL;
> -
> -	ghdr = NLMSG_DATA(&req.n);
> -	ghdr->cmd = CTRL_CMD_GETFAMILY;
> -
> -	if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0) {
> -		fprintf(stderr, "Cannot open generic netlink socket\n");
> -		exit(1);
> -	}
> -
> -	addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1);
> -
> -	if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL) < 0) {
> -		fprintf(stderr, "Error talking to the kernel\n");
> -		goto errout;
> -	}
> -
> -	{
> -		struct rtattr *tb[CTRL_ATTR_MAX + 1];
> -		struct genlmsghdr *ghdr = NLMSG_DATA(nlh);
> -		int len = nlh->nlmsg_len;
> -		struct rtattr *attrs;
> -
> -		if (nlh->nlmsg_type !=  GENL_ID_CTRL) {
> -			fprintf(stderr, "Not a controller message, nlmsg_len=%d "
> -				"nlmsg_type=0x%x\n", nlh->nlmsg_len, nlh->nlmsg_type);
> -			goto errout;
> -		}
> -
> -		if (ghdr->cmd != CTRL_CMD_NEWFAMILY) {
> -			fprintf(stderr, "Unkown controller command %d\n", ghdr->cmd);
> -			goto errout;
> -		}
> -
> -		len -= NLMSG_LENGTH(GENL_HDRLEN);
> -
> -		if (len < 0) {
> -			fprintf(stderr, "wrong controller message len %d\n", len);
> -			return -1;
> -		}
> -
> -		attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN);
> -		parse_rtattr(tb, CTRL_ATTR_MAX, attrs, len);
> -
> -		if (tb[CTRL_ATTR_FAMILY_ID] == NULL) {
> -			fprintf(stderr, "Missing family id TLV\n");
> -			goto errout;
> -		}
> -
> -		ret = *(__u16 *) RTA_DATA(tb[CTRL_ATTR_FAMILY_ID]);
> -	}
> -
> -errout:
> -	rtnl_close(&rth);
> -	return ret;
> -}
> -
> -static int do_veth_operate(char *dev, char *peer, int cmd)
> -{
> -	struct rtnl_handle rth;
> -	struct nlmsghdr *nlh;
> -	struct genlmsghdr *ghdr;
> -	struct nlattr *attr;
> -	struct  {
> -		struct nlmsghdr n;
> -		struct genlmsghdr h;
> -		char bug[1024];
> -	} req;
> -	int family, len;
> -	int err = 0;
> -
> -	family = genl_ctrl_resolve_family("veth");
> -	if (family == 0) {
> -		fprintf(stderr, "veth: Can't resolve family\n");
> -		exit(1);
> -	}
> -
> -	if (rtnl_open_byproto(&rth, 0, NETLINK_GENERIC) < 0)
> -		exit(1);
> -
> -	nlh = &req.n;
> -	nlh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
> -	nlh->nlmsg_flags = NLM_F_REQUEST;
> -	nlh->nlmsg_type = family;
> -	nlh->nlmsg_seq = 0;
> -
> -	ghdr = &req.h;
> -	ghdr->cmd = cmd;
> -
> -	attr = (struct nlattr *) GENLMSG_DATA(&req);
> -	len = strlen(dev);
> -	attr->nla_type = VETH_ATTR_DEVNAME;
> -	attr->nla_len = len + 1 + NLA_HDRLEN;
> -	memcpy(NLA_DATA(attr), dev, len);
> -	nlh->nlmsg_len += NLMSG_ALIGN(attr->nla_len);
> -
> -	if (peer) {
> -		attr = (struct nlattr *)((char *)attr +
> -				NLMSG_ALIGN(attr->nla_len));
> -		len = strlen(peer);
> -		attr->nla_type = VETH_ATTR_PEERNAME;
> -		attr->nla_len = len + 1 + NLA_HDRLEN;
> -		memcpy(NLA_DATA(attr), peer, len);
> -		nlh->nlmsg_len += NLMSG_ALIGN(attr->nla_len);
> -	}
> -
> -	if (rtnl_send(&rth, (char *) &req, nlh->nlmsg_len) < 0) {
> -		err = -1;
> -		fprintf(stderr, "Error talking to the kernel (add)\n");
> -	}
> -
> -	rtnl_close(&rth);
> -	return err;
> -}
> -
> -static int do_veth_add(int argc, char **argv)
> -{
> -	if (argc < 2)
> -		return do_veth_help();
> -
> -	return do_veth_operate(argv[0], argv[1], VETH_CMD_ADD);
> -}
> -
> -static int do_veth_del(int argc, char **argv)
> -{
> -	char *name;
> -
> -	if (argc < 1)
> -		return do_veth_help();
> -
> -	return do_veth_operate(argv[0], NULL, VETH_CMD_DEL);
> -}
> -
> -int do_veth(int argc, char **argv)
> -{
> -	if (argc == 0)
> -		return do_veth_help();
> -
> -	if (strcmp(*argv, "add") == 0 || strcmp(*argv, "a") == 0)
> -		return do_veth_add(argc - 1, argv + 1);
> -	if (strcmp(*argv, "del") == 0 || strcmp(*argv, "d") == 0)
> -		return do_veth_del(argc - 1, argv + 1);
> -	if (strcmp(*argv, "help") == 0)
> -		return do_veth_help();
> -
> -	fprintf(stderr, "Command \"%s\" is unknown, try \"ip veth help\".\n", *argv);
> -	exit(-1);
> -}
> diff --git a/ip/veth.h b/ip/veth.h
> deleted file mode 100644
> index 4d7b357..0000000
> --- a/ip/veth.h
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -int do_veth(int argc, char **argv);
> -
> -enum {
> -	VETH_CMD_UNSPEC, 
> -	VETH_CMD_ADD, 
> -	VETH_CMD_DEL,
> -
> -	VETH_CMD_MAX
> -};
> -
> -enum {
> -	VETH_ATTR_UNSPEC,
> -	VETH_ATTR_DEVNAME,
> -	VETH_ATTR_PEERNAME,
> -
> -	VETH_ATTR_MAX
> -};


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/6] [IPROUTE2] Introduce iplink_parse() routine
  2007-09-12 12:55 [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware" Eric W. Biederman
  2007-09-12 12:55 ` Pavel Emelyanov
@ 2007-09-12 12:58 ` Eric W. Biederman
  2007-09-12 12:59   ` [PATCH 3/4] [IPROUTE2] Module for ip utility to support veth device Eric W. Biederman
  1 sibling, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 12:58 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy

From: Pavel Emelyanov <xemul@openvz.org>
Date: Thu, 19 Jul 2007 13:32:31 +0400

This routine parses CLI attributes, describing generic link
parameters such as name, address, etc.

This is mostly copy-pasted from iplink_modify().

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
---
 include/utils.h |    3 +
 ip/iplink.c     |  127 +++++++++++++++++++++++++++++++-----------------------
 2 files changed, 76 insertions(+), 54 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index a3fd335..3fd851d 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -146,4 +146,7 @@ extern int cmdlineno;
 extern size_t getcmdline(char **line, size_t *len, FILE *in);
 extern int makeargs(char *line, char *argv[], int maxargs);
 
+struct iplink_req;
+int iplink_parse(int argc, char **argv, struct iplink_req *req,
+		char **name, char **type, char **link, char **dev);
 #endif /* __UTILS_H__ */
diff --git a/ip/iplink.c b/ip/iplink.c
index 4060845..64989b2 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -142,140 +142,159 @@ static int iplink_have_newlink(void)
 }
 #endif /* ! IPLINK_IOCTL_COMPAT */
 
-static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
+struct iplink_req {
+	struct nlmsghdr		n;
+	struct ifinfomsg	i;
+	char			buf[1024];
+};
+
+int iplink_parse(int argc, char **argv, struct iplink_req *req,
+		char **name, char **type, char **link, char **dev)
 {
+	int ret, len;
+	char abuf[32];
 	int qlen = -1;
 	int mtu = -1;
-	int len;
-	char abuf[32];
-	char *dev = NULL;
-	char *name = NULL;
-	char *link = NULL;
-	char *type = NULL;
-	struct link_util *lu = NULL;
-	struct {
-		struct nlmsghdr		n;
-		struct ifinfomsg	i;
-		char			buf[1024];
-	} req;
 
-	memset(&req, 0, sizeof(req));
-
-	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
-	req.n.nlmsg_flags = NLM_F_REQUEST|flags;
-	req.n.nlmsg_type = cmd;
-	req.i.ifi_family = preferred_family;
+	ret = argc;
 
 	while (argc > 0) {
 		if (strcmp(*argv, "up") == 0) {
-			req.i.ifi_change |= IFF_UP;
-			req.i.ifi_flags |= IFF_UP;
+			req->i.ifi_change |= IFF_UP;
+			req->i.ifi_flags |= IFF_UP;
 		} else if (strcmp(*argv, "down") == 0) {
-			req.i.ifi_change |= IFF_UP;
-			req.i.ifi_flags &= ~IFF_UP;
+			req->i.ifi_change |= IFF_UP;
+			req->i.ifi_flags &= ~IFF_UP;
 		} else if (strcmp(*argv, "name") == 0) {
 			NEXT_ARG();
-			name = *argv;
+			*name = *argv;
 		} else if (matches(*argv, "link") == 0) {
 			NEXT_ARG();
-			link = *argv;
+			*link = *argv;
 		} else if (matches(*argv, "address") == 0) {
 			NEXT_ARG();
 			len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
-			addattr_l(&req.n, sizeof(req), IFLA_ADDRESS, abuf, len);
+			addattr_l(&req->n, sizeof(*req), IFLA_ADDRESS, abuf, len);
 		} else if (matches(*argv, "broadcast") == 0 ||
-			   strcmp(*argv, "brd") == 0) {
+				strcmp(*argv, "brd") == 0) {
 			NEXT_ARG();
 			len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
-			addattr_l(&req.n, sizeof(req), IFLA_BROADCAST, abuf, len);
+			addattr_l(&req->n, sizeof(*req), IFLA_BROADCAST, abuf, len);
 		} else if (matches(*argv, "txqueuelen") == 0 ||
-			   strcmp(*argv, "qlen") == 0 ||
-			   matches(*argv, "txqlen") == 0) {
+				strcmp(*argv, "qlen") == 0 ||
+				matches(*argv, "txqlen") == 0) {
 			NEXT_ARG();
 			if (qlen != -1)
 				duparg("txqueuelen", *argv);
 			if (get_integer(&qlen,  *argv, 0))
 				invarg("Invalid \"txqueuelen\" value\n", *argv);
-			addattr_l(&req.n, sizeof(req), IFLA_TXQLEN, &qlen, 4);
+			addattr_l(&req->n, sizeof(*req), IFLA_TXQLEN, &qlen, 4);
 		} else if (strcmp(*argv, "mtu") == 0) {
 			NEXT_ARG();
 			if (mtu != -1)
 				duparg("mtu", *argv);
 			if (get_integer(&mtu, *argv, 0))
 				invarg("Invalid \"mtu\" value\n", *argv);
-			addattr_l(&req.n, sizeof(req), IFLA_MTU, &mtu, 4);
+			addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4);
 		} else if (strcmp(*argv, "multicast") == 0) {
 			NEXT_ARG();
-			req.i.ifi_change |= IFF_MULTICAST;
+			req->i.ifi_change |= IFF_MULTICAST;
 			if (strcmp(*argv, "on") == 0) {
-				req.i.ifi_flags |= IFF_MULTICAST;
+				req->i.ifi_flags |= IFF_MULTICAST;
 			} else if (strcmp(*argv, "off") == 0) {
-				req.i.ifi_flags &= ~IFF_MULTICAST;
+				req->i.ifi_flags &= ~IFF_MULTICAST;
 			} else
 				return on_off("multicast");
 		} else if (strcmp(*argv, "allmulticast") == 0) {
 			NEXT_ARG();
-			req.i.ifi_change |= IFF_ALLMULTI;
+			req->i.ifi_change |= IFF_ALLMULTI;
 			if (strcmp(*argv, "on") == 0) {
-				req.i.ifi_flags |= IFF_ALLMULTI;
+				req->i.ifi_flags |= IFF_ALLMULTI;
 			} else if (strcmp(*argv, "off") == 0) {
-				req.i.ifi_flags &= ~IFF_ALLMULTI;
+				req->i.ifi_flags &= ~IFF_ALLMULTI;
 			} else
 				return on_off("allmulticast");
 		} else if (strcmp(*argv, "promisc") == 0) {
 			NEXT_ARG();
-			req.i.ifi_change |= IFF_PROMISC;
+			req->i.ifi_change |= IFF_PROMISC;
 			if (strcmp(*argv, "on") == 0) {
-				req.i.ifi_flags |= IFF_PROMISC;
+				req->i.ifi_flags |= IFF_PROMISC;
 			} else if (strcmp(*argv, "off") == 0) {
-				req.i.ifi_flags &= ~IFF_PROMISC;
+				req->i.ifi_flags &= ~IFF_PROMISC;
 			} else
 				return on_off("promisc");
 		} else if (strcmp(*argv, "trailers") == 0) {
 			NEXT_ARG();
-			req.i.ifi_change |= IFF_NOTRAILERS;
+			req->i.ifi_change |= IFF_NOTRAILERS;
 			if (strcmp(*argv, "off") == 0) {
-				req.i.ifi_flags |= IFF_NOTRAILERS;
+				req->i.ifi_flags |= IFF_NOTRAILERS;
 			} else if (strcmp(*argv, "on") == 0) {
-				req.i.ifi_flags &= ~IFF_NOTRAILERS;
+				req->i.ifi_flags &= ~IFF_NOTRAILERS;
 			} else
 				return on_off("trailers");
 		} else if (strcmp(*argv, "arp") == 0) {
 			NEXT_ARG();
-			req.i.ifi_change |= IFF_NOARP;
+			req->i.ifi_change |= IFF_NOARP;
 			if (strcmp(*argv, "on") == 0) {
-				req.i.ifi_flags &= ~IFF_NOARP;
+				req->i.ifi_flags &= ~IFF_NOARP;
 			} else if (strcmp(*argv, "off") == 0) {
-				req.i.ifi_flags |= IFF_NOARP;
+				req->i.ifi_flags |= IFF_NOARP;
 			} else
 				return on_off("noarp");
 #ifdef IFF_DYNAMIC
 		} else if (matches(*argv, "dynamic") == 0) {
 			NEXT_ARG();
-			req.i.ifi_change |= IFF_DYNAMIC;
+			req->i.ifi_change |= IFF_DYNAMIC;
 			if (strcmp(*argv, "on") == 0) {
-				req.i.ifi_flags |= IFF_DYNAMIC;
+				req->i.ifi_flags |= IFF_DYNAMIC;
 			} else if (strcmp(*argv, "off") == 0) {
-				req.i.ifi_flags &= ~IFF_DYNAMIC;
+				req->i.ifi_flags &= ~IFF_DYNAMIC;
 			} else
 				return on_off("dynamic");
 #endif
 		} else if (matches(*argv, "type") == 0) {
 			NEXT_ARG();
-			type = *argv;
+			*type = *argv;
 			argc--; argv++;
 			break;
 		} else {
-                        if (strcmp(*argv, "dev") == 0) {
+			if (strcmp(*argv, "dev") == 0) {
 				NEXT_ARG();
 			}
-			if (dev)
+			if (*dev)
 				duparg2("dev", *argv);
-			dev = *argv;
+			*dev = *argv;
 		}
 		argc--; argv++;
 	}
 
+	return ret - argc;
+}
+
+static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
+{
+	int len;
+	char *dev = NULL;
+	char *name = NULL;
+	char *link = NULL;
+	char *type = NULL;
+	struct link_util *lu = NULL;
+	struct iplink_req req;
+	int ret;
+
+	memset(&req, 0, sizeof(req));
+
+	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
+	req.n.nlmsg_flags = NLM_F_REQUEST|flags;
+	req.n.nlmsg_type = cmd;
+	req.i.ifi_family = preferred_family;
+
+	ret = iplink_parse(argc, argv, &req, &name, &type, &link, &dev);
+	if (ret < 0)
+		return ret;
+
+	argc -= ret;
+	argv += ret;
 	ll_init_map(&rth);
 
 	if (type) {
-- 
1.5.3.rc6.17.g1911


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/4] [IPROUTE2] Module for ip utility to support veth device
  2007-09-12 12:58 ` [PATCH 2/6] [IPROUTE2] Introduce iplink_parse() routine Eric W. Biederman
@ 2007-09-12 12:59   ` Eric W. Biederman
  2007-09-12 13:01     ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Eric W. Biederman
  0 siblings, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 12:59 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy

From: Pavel Emelyanov <xemul@openvz.org>
Date: Thu, 19 Jul 2007 13:33:56 +0400

The link_veth.so itself.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
---
 ip/Makefile    |    6 ++++-
 ip/link_veth.c |   63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ip/veth.h      |   12 ++++++++++
 3 files changed, 80 insertions(+), 1 deletions(-)
 create mode 100644 ip/link_veth.c
 create mode 100644 ip/veth.h

diff --git a/ip/Makefile b/ip/Makefile
index 9a5bfe3..b46bce3 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -8,8 +8,9 @@ RTMONOBJ=rtmon.o
 ALLOBJ=$(IPOBJ) $(RTMONOBJ)
 SCRIPTS=ifcfg rtpr routel routef
 TARGETS=ip rtmon
+LIBS=link_veth.so
 
-all: $(TARGETS) $(SCRIPTS)
+all: $(TARGETS) $(SCRIPTS) $(LIBS)
 
 ip: $(IPOBJ) $(LIBNETLINK) $(LIBUTIL)
 
@@ -24,3 +25,6 @@ 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
new file mode 100644
index 0000000..ded2cdd
--- /dev/null
+++ b/ip/link_veth.c
@@ -0,0 +1,63 @@
+/*
+ * link_veth.c	veth driver module
+ *
+ *		This program is free software; you can redistribute it and/or
+ *		modify it under the terms of the GNU General Public License
+ *		as published by the Free Software Foundation; either version
+ *		2 of the License, or (at your option) any later version.
+ *
+ * Authors:	Pavel Emelianov <xemul@openvz.org>
+ *
+ */
+
+#include <string.h>
+
+#include "utils.h"
+#include "ip_common.h"
+#include "veth.h"
+
+#define	IFNAMSIZ	16
+
+static void usage(void)
+{
+	printf("Usage: ip link add ... type veth "
+			"[peer <peer-name>] [mac <mac>] [peer_mac <mac>]\n");
+}
+
+static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
+		struct nlmsghdr *hdr)
+{
+	char *name, *type, *link, *dev;
+	int err, len;
+	struct rtattr * data;
+
+	if (strcmp(argv[0], "peer") != 0) {
+		usage();
+		return -1;
+	}
+
+	data = NLMSG_TAIL(hdr);
+	addattr_l(hdr, 1024, VETH_INFO_PEER, NULL, 0);
+
+	hdr->nlmsg_len += sizeof(struct ifinfomsg);
+
+	err = iplink_parse(argc - 1, argv + 1, (struct iplink_req *)hdr,
+			&name, &type, &link, &dev);
+	if (err < 0)
+		return err;
+
+	if (name) {
+		len = strlen(name) + 1;
+		if (len > IFNAMSIZ)
+			invarg("\"name\" too long\n", *argv);
+		addattr_l(hdr, 1024, IFLA_IFNAME, name, len);
+	}
+
+	data->rta_len = (void *)NLMSG_TAIL(hdr) - (void *)data;
+	return argc - 1 - err;
+}
+
+struct link_util veth_link_util = {
+	.id = "veth",
+	.parse_opt = veth_parse_opt,
+};
diff --git a/ip/veth.h b/ip/veth.h
new file mode 100644
index 0000000..aa2e6f9
--- /dev/null
+++ b/ip/veth.h
@@ -0,0 +1,12 @@
+#ifndef __NET_VETH_H__
+#define __NET_VETH_H__
+
+enum {
+	VETH_INFO_UNSPEC,
+	VETH_INFO_PEER,
+
+	__VETH_INFO_MAX
+#define VETH_INFO_MAX	(__VETH_INFO_MAX - 1)
+};
+
+#endif
-- 
1.5.3.rc6.17.g1911


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes.
  2007-09-12 12:59   ` [PATCH 3/4] [IPROUTE2] Module for ip utility to support veth device Eric W. Biederman
@ 2007-09-12 13:01     ` Eric W. Biederman
  2007-09-12 13:03       ` [PATCH] [IPROUTE2] Basic documentation for dynamic link creation/destruction Eric W. Biederman
  2007-09-12 14:33       ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Pavel Emelyanov
  0 siblings, 2 replies; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 13:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy

From: Eric W. Biederman <ebiederm@xmission.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@xmission.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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] [IPROUTE2] Basic documentation for dynamic link creation/destruction.
  2007-09-12 13:01     ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Eric W. Biederman
@ 2007-09-12 13:03       ` Eric W. Biederman
  2007-09-12 13:05         ` [PATCH] [IPROUTE2] Add support for moving links between network namespaces Eric W. Biederman
  2007-09-12 14:33       ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Pavel Emelyanov
  1 sibling, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 13:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy


This updates the usage to indicate that we have support link creation
and destruction in addition to just setting link parameters.

It's not really great documentation of the new netlink support
for link creations and removal but it is a start.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 ip/iplink.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index 64989b2..541f3d6 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -38,7 +38,8 @@ static void usage(void) __attribute__((noreturn));
 
 void iplink_usage(void)
 {
-	fprintf(stderr, "Usage: ip link set DEVICE { up | down |\n");
+	fprintf(stderr, "Usage: ip link { set | add | replace | delete } DEVICE {\n");
+	fprintf(stderr, "			     up | down |\n");
 	fprintf(stderr, "	                     arp { on | off } |\n");
 	fprintf(stderr, "	                     dynamic { on | off } |\n");
 	fprintf(stderr, "	                     multicast { on | off } |\n");
@@ -48,7 +49,9 @@ void iplink_usage(void)
 	fprintf(stderr, "	                     txqueuelen PACKETS |\n");
 	fprintf(stderr, "	                     name NEWNAME |\n");
 	fprintf(stderr, "	                     address LLADDR | broadcast LLADDR |\n");
-	fprintf(stderr, "	                     mtu MTU }\n");
+	fprintf(stderr, "	                     mtu MTU | \n");
+	fprintf(stderr, "			     type TYPE [ TYPE specifc options]\n");
+	fprintf(stderr, "			     }\n");
 	fprintf(stderr, "       ip link show [ DEVICE ]\n");
 	exit(-1);
 }
-- 
1.5.3.rc6.17.g1911


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] [IPROUTE2] Add support for moving links between network namespaces
  2007-09-12 13:03       ` [PATCH] [IPROUTE2] Basic documentation for dynamic link creation/destruction Eric W. Biederman
@ 2007-09-12 13:05         ` Eric W. Biederman
  2007-09-12 13:39           ` Stephen Hemminger
  0 siblings, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 13:05 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy


This adds support for setting the IFLA_NET_NS_PID attribute
on links allowing them to be moved between network namespaces.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 include/linux/if_link.h |    1 +
 ip/iplink.c             |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 23b3a8e..c948395 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -78,6 +78,7 @@ enum
 	IFLA_LINKMODE,
 	IFLA_LINKINFO,
 #define IFLA_LINKINFO IFLA_LINKINFO
+	IFLA_NET_NS_PID,
 	__IFLA_MAX
 };
 
diff --git a/ip/iplink.c b/ip/iplink.c
index 541f3d6..624c784 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -158,6 +158,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 	char abuf[32];
 	int qlen = -1;
 	int mtu = -1;
+	pid_t netns_pid = -1;
 
 	ret = argc;
 
@@ -255,6 +256,14 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 			} else
 				return on_off("dynamic");
 #endif
+		} else if (matches(*argv, "netnspid") == 0) {
+			NEXT_ARG();
+			if (netns_pid != -1)
+				duparg("netnspid", *argv);
+			if (get_integer(&netns_pid, *argv, 0))
+				invarg("Invalid \"netnspid\" value\n", *argv);
+			addattr_l(&req->n, sizeof(*req), IFLA_NET_NS_PID,
+				&netns_pid, sizeof(netns_pid));
 		} else if (matches(*argv, "type") == 0) {
 			NEXT_ARG();
 			*type = *argv;
-- 
1.5.3.rc6.17.g1911


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware"
  2007-09-12 12:55 ` Pavel Emelyanov
@ 2007-09-12 13:09   ` Eric W. Biederman
  2007-09-12 13:48     ` Eric W. Biederman
  0 siblings, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 13:09 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: Stephen Hemminger, netdev, Patrick McHardy

Pavel Emelyanov <xemul@openvz.org> writes:

> Eric W. Biederman wrote:
>> Stephen it looks like you weren't cc'd on the latest version
>> of the veth support.  So this patchset first reverts the old
>
> He was. The latest version looks completely different from what
> is reversed in this patch.

This is against the latest snapshot I could find.  My apologies
if I missed some of the communication.

Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] [IPROUTE2] Add support for moving links between network namespaces
  2007-09-12 13:05         ` [PATCH] [IPROUTE2] Add support for moving links between network namespaces Eric W. Biederman
@ 2007-09-12 13:39           ` Stephen Hemminger
  2007-09-12 14:06             ` Eric W. Biederman
  0 siblings, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2007-09-12 13:39 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: netdev, Pavel Emelyanov, Patrick McHardy

On Wed, 12 Sep 2007 07:05:42 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> 
> This adds support for setting the IFLA_NET_NS_PID attribute
> on links allowing them to be moved between network namespaces.
> 
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> ---
>  include/linux/if_link.h |    1 +
>  ip/iplink.c             |    9 +++++++++
>  2 files changed, 10 insertions(+), 0 deletions(-)

Please don't mix header file updates with command changes.
As a first step, I always install standard kernel santized headers.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware"
  2007-09-12 13:09   ` Eric W. Biederman
@ 2007-09-12 13:48     ` Eric W. Biederman
  0 siblings, 0 replies; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 13:48 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: Stephen Hemminger, netdev, Patrick McHardy

ebiederm@xmission.com (Eric W. Biederman) writes:

> Pavel Emelyanov <xemul@openvz.org> writes:
>
>> Eric W. Biederman wrote:
>>> Stephen it looks like you weren't cc'd on the latest version
>>> of the veth support.  So this patchset first reverts the old
>>
>> He was. The latest version looks completely different from what
>> is reversed in this patch.
>
> This is against the latest snapshot I could find.  My apologies
> if I missed some of the communication.

I was working against:
git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git

And the last I could find of the conversation about veth support was
in the thread announcing iproute-2-2.6.23-rc3, and Stephen Hemminger
asking for the latest version of the veth support to be sent on
Sept 1st.

So it is quite possible this has been resolved in private email,
and nothing public has been updated yet.

I just don't have a copy of anything newer, and I don't know where else
I would look for something newer.  So since I'm starting to use veth
I sent the patches I had to make it work.

The last round of veth support for iproute2 I could find was sent
on the 19th of July and David Miller, Patrick McHardy, and netdev
were copied but Stephen Hemminger wasn't.  Which is where my
assertion that Stephen hadn't been sent the latest version came from.

If you guys have already sorted this out and I just can't find the
code I'm overjoyed.  Otherwise the patches I sent should be enough
to get things sorted out, if I have figure out the current state of
confusion.

Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] [IPROUTE2] Add support for moving links between network namespaces
  2007-09-12 13:39           ` Stephen Hemminger
@ 2007-09-12 14:06             ` Eric W. Biederman
  2007-09-12 14:13               ` Stephen Hemminger
  0 siblings, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 14:06 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Pavel Emelyanov, Patrick McHardy

Stephen Hemminger <shemminger@linux-foundation.org> writes:

> On Wed, 12 Sep 2007 07:05:42 -0600
> ebiederm@xmission.com (Eric W. Biederman) wrote:
>
>> 
>> This adds support for setting the IFLA_NET_NS_PID attribute
>> on links allowing them to be moved between network namespaces.
>> 
>> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
>> ---
>>  include/linux/if_link.h |    1 +
>>  ip/iplink.c             |    9 +++++++++
>>  2 files changed, 10 insertions(+), 0 deletions(-)
>
> Please don't mix header file updates with command changes.
> As a first step, I always install standard kernel santized headers.

Sorry I didn't know.  Those changes are now in net-2.6.24
so installing sanitized headers should not change anything.

In please feel free to drop the if_link.h part, and if you want
I can resend that patch with those few lines deleted.

Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] [IPROUTE2] Add support for moving links between network namespaces
  2007-09-12 14:06             ` Eric W. Biederman
@ 2007-09-12 14:13               ` Stephen Hemminger
  0 siblings, 0 replies; 15+ messages in thread
From: Stephen Hemminger @ 2007-09-12 14:13 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: netdev, Pavel Emelyanov, Patrick McHardy

On Wed, 12 Sep 2007 08:06:08 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> Stephen Hemminger <shemminger@linux-foundation.org> writes:
> 
> > On Wed, 12 Sep 2007 07:05:42 -0600
> > ebiederm@xmission.com (Eric W. Biederman) wrote:
> >
> >> 
> >> This adds support for setting the IFLA_NET_NS_PID attribute
> >> on links allowing them to be moved between network namespaces.
> >> 
> >> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> >> ---
> >>  include/linux/if_link.h |    1 +
> >>  ip/iplink.c             |    9 +++++++++
> >>  2 files changed, 10 insertions(+), 0 deletions(-)
> >
> > Please don't mix header file updates with command changes.
> > As a first step, I always install standard kernel santized headers.
> 
> Sorry I didn't know.  Those changes are now in net-2.6.24
> so installing sanitized headers should not change anything.
> 
> In please feel free to drop the if_link.h part, and if you want
> I can resend that patch with those few lines deleted.
> 
> Eric

I take care of fixing patches (as long as they aren't really damaged).

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes.
  2007-09-12 13:01     ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Eric W. Biederman
  2007-09-12 13:03       ` [PATCH] [IPROUTE2] Basic documentation for dynamic link creation/destruction Eric W. Biederman
@ 2007-09-12 14:33       ` Pavel Emelyanov
  2007-09-12 15:13         ` Eric W. Biederman
  1 sibling, 1 reply; 15+ messages in thread
From: Pavel Emelyanov @ 2007-09-12 14:33 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Stephen Hemminger, netdev, Patrick McHardy

[snip]

> @@ -25,6 +26,3 @@ clean:
>  
>  LDLIBS	+= -ldl
>  LDFLAGS	+= -Wl,-export-dynamic
> -
> -%.so: %.c
> -	$(CC) $(CFLAGS) -shared $< -o $@

%) How do we get the .so file then?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes.
  2007-09-12 14:33       ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Pavel Emelyanov
@ 2007-09-12 15:13         ` Eric W. Biederman
  2007-09-13 10:30           ` Stephen Hemminger
  0 siblings, 1 reply; 15+ messages in thread
From: Eric W. Biederman @ 2007-09-12 15:13 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: Stephen Hemminger, netdev, Patrick McHardy

Pavel Emelyanov <xemul@openvz.org> writes:

> [snip]
>
>> @@ -25,6 +26,3 @@ clean:
>>  
>>  LDLIBS	+= -ldl
>>  LDFLAGS	+= -Wl,-export-dynamic
>> -
>> -%.so: %.c
>> -	$(CC) $(CFLAGS) -shared $< -o $@
>
> %) How do we get the .so file then?

The code was built into iproute2, so we don't need the .so file.
That rule does not work on arch/x86_64 so I had to do something
and the easiest was to simply compile the code in.  Like Patrick
did with his recent VLAN support.

The usefulness of a .so file seems to be distributing the code
outside of /bin/ip.  Although I think we currently have some issues with
mixed 32bit and 64bit systems because we have "/usr/lib/ip/link_*.so"
hard coded.

A .so file always seems to override the compiled in version so I don't
think we loose any flexibility on that front.

Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes.
  2007-09-12 15:13         ` Eric W. Biederman
@ 2007-09-13 10:30           ` Stephen Hemminger
  0 siblings, 0 replies; 15+ messages in thread
From: Stephen Hemminger @ 2007-09-13 10:30 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Pavel Emelyanov, netdev, Patrick McHardy

On Wed, 12 Sep 2007 09:13:02 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> Pavel Emelyanov <xemul@openvz.org> writes:
> 
> > [snip]
> >
> >> @@ -25,6 +26,3 @@ clean:
> >>  
> >>  LDLIBS	+= -ldl
> >>  LDFLAGS	+= -Wl,-export-dynamic
> >> -
> >> -%.so: %.c
> >> -	$(CC) $(CFLAGS) -shared $< -o $@
> >
> > %) How do we get the .so file then?
> 
> The code was built into iproute2, so we don't need the .so file.
> That rule does not work on arch/x86_64 so I had to do something
> and the easiest was to simply compile the code in.  Like Patrick
> did with his recent VLAN support.
> 
> The usefulness of a .so file seems to be distributing the code
> outside of /bin/ip.  Although I think we currently have some issues with
> mixed 32bit and 64bit systems because we have "/usr/lib/ip/link_*.so"
> hard coded.
> 
> A .so file always seems to override the compiled in version so I don't
> think we loose any flexibility on that front.
> 
> Eric

Fixing the 64 bit library path is on my to fix list.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-09-13 10:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-12 12:55 [PATCH 1/4] [IPROUTE2] Revert "Make ip utility veth driver aware" Eric W. Biederman
2007-09-12 12:55 ` Pavel Emelyanov
2007-09-12 13:09   ` Eric W. Biederman
2007-09-12 13:48     ` Eric W. Biederman
2007-09-12 12:58 ` [PATCH 2/6] [IPROUTE2] Introduce iplink_parse() routine Eric W. Biederman
2007-09-12 12:59   ` [PATCH 3/4] [IPROUTE2] Module for ip utility to support veth device Eric W. Biederman
2007-09-12 13:01     ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Eric W. Biederman
2007-09-12 13:03       ` [PATCH] [IPROUTE2] Basic documentation for dynamic link creation/destruction Eric W. Biederman
2007-09-12 13:05         ` [PATCH] [IPROUTE2] Add support for moving links between network namespaces Eric W. Biederman
2007-09-12 13:39           ` Stephen Hemminger
2007-09-12 14:06             ` Eric W. Biederman
2007-09-12 14:13               ` Stephen Hemminger
2007-09-12 14:33       ` [PATCH 4/4] [IPROUTE2] iproute2: link_veth support bug fixes Pavel Emelyanov
2007-09-12 15:13         ` Eric W. Biederman
2007-09-13 10:30           ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).