From 7b15813c33e49ed579eef6c261fc711e1da5e436 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 19 Aug 2018 20:14:25 +0200 Subject: [PATCH] macro: add macvlan properties Signed-off-by: Christian Brauner --- src/lxc/confile_utils.c | 10 +++++----- src/lxc/confile_utils.h | 18 ++---------------- src/lxc/macro.h | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c index 2bb46d17b..9b133147a 100644 --- a/src/lxc/confile_utils.c +++ b/src/lxc/confile_utils.c @@ -32,6 +32,7 @@ #include "list.h" #include "log.h" #include "lxccontainer.h" +#include "macro.h" #include "network.h" #include "parse.h" #include "utils.h" @@ -288,13 +289,12 @@ void lxc_log_configured_netdevs(const struct lxc_conf *conf) TRACE("type: macvlan"); if (netdev->priv.macvlan_attr.mode > 0) { - char *macvlan_mode; + char *mode; - macvlan_mode = lxc_macvlan_flag_to_mode( + mode = lxc_macvlan_flag_to_mode( netdev->priv.macvlan_attr.mode); TRACE("macvlan mode: %s", - macvlan_mode ? macvlan_mode - : "(invalid mode)"); + mode ? mode : "(invalid mode)"); } break; case LXC_NET_VLAN: @@ -442,7 +442,7 @@ void lxc_free_networks(struct lxc_list *networks) lxc_list_init(networks); } -static struct macvlan_mode { +static struct lxc_macvlan_mode { char *name; int mode; } macvlan_mode[] = { diff --git a/src/lxc/confile_utils.h b/src/lxc/confile_utils.h index b58ce47b2..eda6aa3dd 100644 --- a/src/lxc/confile_utils.h +++ b/src/lxc/confile_utils.h @@ -20,27 +20,13 @@ #ifndef __LXC_CONFILE_UTILS_H #define __LXC_CONFILE_UTILS_H +#include "config.h" + #include #include "conf.h" #include "confile_utils.h" -#ifndef MACVLAN_MODE_PRIVATE -#define MACVLAN_MODE_PRIVATE 1 -#endif - -#ifndef MACVLAN_MODE_VEPA -#define MACVLAN_MODE_VEPA 2 -#endif - -#ifndef MACVLAN_MODE_BRIDGE -#define MACVLAN_MODE_BRIDGE 4 -#endif - -#ifndef MACVLAN_MODE_PASSTHRU -#define MACVLAN_MODE_PASSTHRU 8 -#endif - #define strprint(str, inlen, ...) \ do { \ if (str) \ diff --git a/src/lxc/macro.h b/src/lxc/macro.h index 7536d6111..6113adc2e 100644 --- a/src/lxc/macro.h +++ b/src/lxc/macro.h @@ -197,6 +197,22 @@ extern int __build_bug_on_failed; #define NLMSG_ERROR 0x2 #endif +#ifndef MACVLAN_MODE_PRIVATE +#define MACVLAN_MODE_PRIVATE 1 +#endif + +#ifndef MACVLAN_MODE_VEPA +#define MACVLAN_MODE_VEPA 2 +#endif + +#ifndef MACVLAN_MODE_BRIDGE +#define MACVLAN_MODE_BRIDGE 4 +#endif + +#ifndef MACVLAN_MODE_PASSTHRU +#define MACVLAN_MODE_PASSTHRU 8 +#endif + /* mount */ #ifndef MS_REC #define MS_REC 16384 -- 2.39.2