From 9985416197e02a7094aa9b457564a2fede721a24 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Wed, 4 Mar 2015 17:22:52 +0100 Subject: [PATCH] macvlan: add 'passthru' mode In setup where we want to sniff with an IDS from inside a container we can use the 'passthru' mode of macvlan. This was not accessible from the config and this patch fixes the issue. Signed-off-by: Eric Leblond --- src/lxc/conf.h | 2 +- src/lxc/confile.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lxc/conf.h b/src/lxc/conf.h index 48f7fa253..aca882c3c 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -100,7 +100,7 @@ struct ifla_vlan { }; struct ifla_macvlan { - int mode; /* private, vepa, bridge */ + int mode; /* private, vepa, bridge, passthru */ }; union netdev_p { diff --git a/src/lxc/confile.c b/src/lxc/confile.c index 7e8b6a2d7..57347351e 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -517,6 +517,10 @@ static int network_ifname(char **valuep, const char *value) # define MACVLAN_MODE_BRIDGE 4 #endif +#ifndef MACVLAN_MODE_PASSTHRU +# define MACVLAN_MODE_PASSTHRU 8 +#endif + static int macvlan_mode(int *valuep, const char *value) { struct mc_mode { @@ -526,6 +530,7 @@ static int macvlan_mode(int *valuep, const char *value) { "private", MACVLAN_MODE_PRIVATE }, { "vepa", MACVLAN_MODE_VEPA }, { "bridge", MACVLAN_MODE_BRIDGE }, + { "passthru", MACVLAN_MODE_PASSTHRU }, }; int i; @@ -2286,6 +2291,7 @@ static int lxc_get_item_nic(struct lxc_conf *c, char *retv, int inlen, case MACVLAN_MODE_PRIVATE: mode = "private"; break; case MACVLAN_MODE_VEPA: mode = "vepa"; break; case MACVLAN_MODE_BRIDGE: mode = "bridge"; break; + case MACVLAN_MODE_PASSTHRU: mode = "passthru"; break; default: mode = "(invalid)"; break; } strprint(retv, inlen, "%s", mode); -- 2.47.3