Commit 99854161 by Eric Leblond

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: 's avatarEric Leblond <eric@regit.org>
parent a7307747
...@@ -100,7 +100,7 @@ struct ifla_vlan { ...@@ -100,7 +100,7 @@ struct ifla_vlan {
}; };
struct ifla_macvlan { struct ifla_macvlan {
int mode; /* private, vepa, bridge */ int mode; /* private, vepa, bridge, passthru */
}; };
union netdev_p { union netdev_p {
......
...@@ -517,6 +517,10 @@ static int network_ifname(char **valuep, const char *value) ...@@ -517,6 +517,10 @@ static int network_ifname(char **valuep, const char *value)
# define MACVLAN_MODE_BRIDGE 4 # define MACVLAN_MODE_BRIDGE 4
#endif #endif
#ifndef MACVLAN_MODE_PASSTHRU
# define MACVLAN_MODE_PASSTHRU 8
#endif
static int macvlan_mode(int *valuep, const char *value) static int macvlan_mode(int *valuep, const char *value)
{ {
struct mc_mode { struct mc_mode {
...@@ -526,6 +530,7 @@ static int macvlan_mode(int *valuep, const char *value) ...@@ -526,6 +530,7 @@ static int macvlan_mode(int *valuep, const char *value)
{ "private", MACVLAN_MODE_PRIVATE }, { "private", MACVLAN_MODE_PRIVATE },
{ "vepa", MACVLAN_MODE_VEPA }, { "vepa", MACVLAN_MODE_VEPA },
{ "bridge", MACVLAN_MODE_BRIDGE }, { "bridge", MACVLAN_MODE_BRIDGE },
{ "passthru", MACVLAN_MODE_PASSTHRU },
}; };
int i; int i;
...@@ -2286,6 +2291,7 @@ static int lxc_get_item_nic(struct lxc_conf *c, char *retv, int inlen, ...@@ -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_PRIVATE: mode = "private"; break;
case MACVLAN_MODE_VEPA: mode = "vepa"; break; case MACVLAN_MODE_VEPA: mode = "vepa"; break;
case MACVLAN_MODE_BRIDGE: mode = "bridge"; break; case MACVLAN_MODE_BRIDGE: mode = "bridge"; break;
case MACVLAN_MODE_PASSTHRU: mode = "passthru"; break;
default: mode = "(invalid)"; break; default: mode = "(invalid)"; break;
} }
strprint(retv, inlen, "%s", mode); strprint(retv, inlen, "%s", mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment