From: Eric Leblond Date: Wed, 4 Mar 2015 16:22:52 +0000 (+0100) Subject: macvlan: add 'passthru' mode X-Git-Tag: lxc-2.0.0.beta1~280^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9985416197e02a7094aa9b457564a2fede721a24;p=thirdparty%2Flxc.git 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 --- 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);