[lxc-devel] [lxc/master] network: Rename primary to master

stgraber on Github lxc-bot at linuxcontainers.org
Thu Jun 18 14:29:55 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 509 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200618/fb70d021/attachment.bin>
-------------- next part --------------
From 0dc9a1425e0925b7c80a04a86ee325b60eac2485 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 18 Jun 2020 10:28:57 -0400
Subject: [PATCH] network: Rename primary to master
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The previous change made things confusing by impliying there may be a
secondary when VLAN/IPVLAN/bridge members can only have a single parent
device.

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 src/lxc/macro.h   |  2 +-
 src/lxc/network.c | 18 +++++++++---------
 src/lxc/network.h |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/lxc/macro.h b/src/lxc/macro.h
index 6f52aeb2ff..2ae1a7bb32 100644
--- a/src/lxc/macro.h
+++ b/src/lxc/macro.h
@@ -389,7 +389,7 @@ extern int __build_bug_on_failed;
 #endif
 
 #ifndef BRIDGE_FLAGS_MASTER
-#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from primary */
+#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from parent */
 #endif
 
 #ifndef BRIDGE_VLAN_INFO_PVID
diff --git a/src/lxc/network.c b/src/lxc/network.c
index 08a643c86b..aa8e1d157f 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -847,7 +847,7 @@ static int instantiate_macvlan(struct lxc_handler *handler, struct lxc_netdev *n
 	return -1;
 }
 
-static int lxc_ipvlan_create(const char *primary, const char *name, int mode, int isolation)
+static int lxc_ipvlan_create(const char *parent, const char *name, int mode, int isolation)
 {
 	call_cleaner(nlmsg_free) struct nlmsg *answer = NULL, *nlmsg = NULL;
 	struct nl_handler nlh;
@@ -856,7 +856,7 @@ static int lxc_ipvlan_create(const char *primary, const char *name, int mode, in
 	struct ifinfomsg *ifi;
 	struct rtattr *nest, *nest2;
 
-	len = strlen(primary);
+	len = strlen(parent);
 	if (len == 1 || len >= IFNAMSIZ)
 		return ret_errno(EINVAL);
 
@@ -864,7 +864,7 @@ static int lxc_ipvlan_create(const char *primary, const char *name, int mode, in
 	if (len == 1 || len >= IFNAMSIZ)
 		return ret_errno(EINVAL);
 
-	index = if_nametoindex(primary);
+	index = if_nametoindex(parent);
 	if (!index)
 		return ret_errno(EINVAL);
 
@@ -2052,7 +2052,7 @@ int lxc_veth_create(const char *name1, const char *name2, pid_t pid, unsigned in
 }
 
 /* TODO: merge with lxc_macvlan_create */
-int lxc_vlan_create(const char *primary, const char *name, unsigned short vlanid)
+int lxc_vlan_create(const char *parent, const char *name, unsigned short vlanid)
 {
 	call_cleaner(nlmsg_free) struct nlmsg *answer = NULL, *nlmsg = NULL;
 	struct nl_handler nlh;
@@ -2065,7 +2065,7 @@ int lxc_vlan_create(const char *primary, const char *name, unsigned short vlanid
 	if (err)
 		return err;
 
-	len = strlen(primary);
+	len = strlen(parent);
 	if (len == 1 || len >= IFNAMSIZ)
 		return ret_errno(EINVAL);
 
@@ -2081,7 +2081,7 @@ int lxc_vlan_create(const char *primary, const char *name, unsigned short vlanid
 	if (!answer)
 		return ret_errno(ENOMEM);
 
-	lindex = if_nametoindex(primary);
+	lindex = if_nametoindex(parent);
 	if (!lindex)
 		return ret_errno(EINVAL);
 
@@ -2120,7 +2120,7 @@ int lxc_vlan_create(const char *primary, const char *name, unsigned short vlanid
 	return netlink_transaction(nlh_ptr, nlmsg, answer);
 }
 
-int lxc_macvlan_create(const char *primary, const char *name, int mode)
+int lxc_macvlan_create(const char *parent, const char *name, int mode)
 {
 	call_cleaner(nlmsg_free) struct nlmsg *answer = NULL, *nlmsg = NULL;
 	struct nl_handler nlh;
@@ -2133,7 +2133,7 @@ int lxc_macvlan_create(const char *primary, const char *name, int mode)
 	if (err)
 		return err;
 
-	len = strlen(primary);
+	len = strlen(parent);
 	if (len == 1 || len >= IFNAMSIZ)
 		return ret_errno(EINVAL);
 
@@ -2149,7 +2149,7 @@ int lxc_macvlan_create(const char *primary, const char *name, int mode)
 	if (!answer)
 		return ret_errno(ENOMEM);
 
-	index = if_nametoindex(primary);
+	index = if_nametoindex(parent);
 	if (!index)
 		return ret_errno(EINVAL);
 
diff --git a/src/lxc/network.h b/src/lxc/network.h
index 6633432cbe..5e91e4eba5 100644
--- a/src/lxc/network.h
+++ b/src/lxc/network.h
@@ -208,8 +208,8 @@ extern int lxc_netdev_set_mtu(const char *name, int mtu);
 /* Create a virtual network devices. */
 extern int lxc_veth_create(const char *name1, const char *name2, pid_t pid,
 			   unsigned int mtu);
-extern int lxc_macvlan_create(const char *primary, const char *name, int mode);
-extern int lxc_vlan_create(const char *primary, const char *name,
+extern int lxc_macvlan_create(const char *parent, const char *name, int mode);
+extern int lxc_vlan_create(const char *parent, const char *name,
 			   unsigned short vid);
 
 /* Set ip address. */


More information about the lxc-devel mailing list