Revert "iproute2: macvlan: add "source" mode"
This reverts commit f33b727610.
The upstream changes are not in 4.9
This commit is contained in:
parent
4710e46ec3
commit
c07a36c3db
|
|
@ -402,8 +402,6 @@ enum macvlan_macaddr_mode {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MACVLAN_FLAG_NOPROMISC 1
|
#define MACVLAN_FLAG_NOPROMISC 1
|
||||||
#define MACVLAN_FLAG_UNICAST 2
|
|
||||||
#define MACVLAN_FLAG_UNICAST_ALL 4
|
|
||||||
|
|
||||||
/* VRF section */
|
/* VRF section */
|
||||||
enum {
|
enum {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <linux/if_link.h>
|
#include <linux/if_link.h>
|
||||||
#include <linux/if_ether.h>
|
|
||||||
|
|
||||||
#include "rt_names.h"
|
#include "rt_names.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
@ -30,11 +29,7 @@
|
||||||
static void print_explain(struct link_util *lu, FILE *f)
|
static void print_explain(struct link_util *lu, FILE *f)
|
||||||
{
|
{
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"Usage: ... %s mode MODE [flag MODE_FLAG] MODE_OPTS\n"
|
"Usage: ... %s mode { private | vepa | bridge | passthru [nopromisc] }\n",
|
||||||
"MODE: private | vepa | bridge | passthru | source\n"
|
|
||||||
"MODE_FLAG: null | nopromisc | unicast | unicast_all\n"
|
|
||||||
"MODE_OPTS: for mode \"source\":\n"
|
|
||||||
"\tmacaddr { add <macaddr> | del <macaddr> | flush }\n",
|
|
||||||
lu->id
|
lu->id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -46,6 +41,7 @@ static void explain(struct link_util *lu)
|
||||||
|
|
||||||
static int mode_arg(const char *arg)
|
static int mode_arg(const char *arg)
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error: argument of \"mode\" must be \"private\", \"vepa\", \"bridge\", \"passthru\" or \"source\", not \"%s\"\n",
|
"Error: argument of \"mode\" must be \"private\", \"vepa\", \"bridge\", \"passthru\" or \"source\", not \"%s\"\n",
|
||||||
arg);
|
arg);
|
||||||
|
|
@ -55,7 +51,7 @@ static int mode_arg(const char *arg)
|
||||||
static int flag_arg(const char *arg)
|
static int flag_arg(const char *arg)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error: argument of \"flag\" must be \"nopromisc\", \"unicast\", \"unicast_all\" or \"null\", not \"%s\"\n",
|
"Error: argument of \"mode\" must be \"private\", \"vepa\", \"bridge\" or \"passthru\", not \"%s\"\n",
|
||||||
arg);
|
arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -65,9 +61,6 @@ static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
{
|
{
|
||||||
__u32 mode = 0;
|
__u32 mode = 0;
|
||||||
__u16 flags = 0;
|
__u16 flags = 0;
|
||||||
__u32 mac_mode = 0;
|
|
||||||
int len = 0;
|
|
||||||
char abuf[32];
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "mode") == 0) {
|
if (matches(*argv, "mode") == 0) {
|
||||||
|
|
@ -81,45 +74,8 @@ static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
mode = MACVLAN_MODE_BRIDGE;
|
mode = MACVLAN_MODE_BRIDGE;
|
||||||
else if (strcmp(*argv, "passthru") == 0)
|
else if (strcmp(*argv, "passthru") == 0)
|
||||||
mode = MACVLAN_MODE_PASSTHRU;
|
mode = MACVLAN_MODE_PASSTHRU;
|
||||||
else if (strcmp(*argv, "source") == 0)
|
|
||||||
mode = MACVLAN_MODE_SOURCE;
|
|
||||||
else
|
else
|
||||||
return mode_arg(*argv);
|
return mode_arg(*argv);
|
||||||
} else if (matches(*argv, "flag") == 0) {
|
|
||||||
NEXT_ARG();
|
|
||||||
|
|
||||||
if (strcmp(*argv, "nopromisc") == 0)
|
|
||||||
flags |= MACVLAN_FLAG_NOPROMISC;
|
|
||||||
else if (strcmp(*argv, "unicast") == 0)
|
|
||||||
flags |= MACVLAN_FLAG_UNICAST;
|
|
||||||
else if (strcmp(*argv, "unicast_all") == 0)
|
|
||||||
flags |= MACVLAN_FLAG_UNICAST_ALL;
|
|
||||||
else if (strcmp(*argv, "null") == 0)
|
|
||||||
flags |= 0;
|
|
||||||
else
|
|
||||||
return flag_arg(*argv);
|
|
||||||
|
|
||||||
} else if (matches(*argv, "macaddr") == 0) {
|
|
||||||
NEXT_ARG();
|
|
||||||
|
|
||||||
if (strcmp(*argv, "add") == 0) {
|
|
||||||
mac_mode = MACVLAN_MACADDR_ADD;
|
|
||||||
} else if (strcmp(*argv, "del") == 0) {
|
|
||||||
mac_mode = MACVLAN_MACADDR_DEL;
|
|
||||||
} else if (strcmp(*argv, "flush") == 0) {
|
|
||||||
mac_mode = MACVLAN_MACADDR_FLUSH;
|
|
||||||
} else {
|
|
||||||
explain(lu);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mac_mode != MACVLAN_MACADDR_FLUSH) {
|
|
||||||
NEXT_ARG();
|
|
||||||
|
|
||||||
len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
|
|
||||||
if (len < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else if (matches(*argv, "nopromisc") == 0) {
|
} else if (matches(*argv, "nopromisc") == 0) {
|
||||||
flags |= MACVLAN_FLAG_NOPROMISC;
|
flags |= MACVLAN_FLAG_NOPROMISC;
|
||||||
} else if (matches(*argv, "help") == 0) {
|
} else if (matches(*argv, "help") == 0) {
|
||||||
|
|
@ -145,12 +101,6 @@ static int macvlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
}
|
}
|
||||||
addattr16(n, 1024, IFLA_MACVLAN_FLAGS, flags);
|
addattr16(n, 1024, IFLA_MACVLAN_FLAGS, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mac_mode) {
|
|
||||||
addattr32(n, 1024, IFLA_MACVLAN_MACADDR_MODE, mac_mode);
|
|
||||||
if (mac_mode != MACVLAN_MACADDR_FLUSH && len > 0)
|
|
||||||
addattr_l(n, 1024, IFLA_MACVLAN_MACADDR, abuf, len);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,10 +108,6 @@ static void macvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]
|
||||||
{
|
{
|
||||||
__u32 mode;
|
__u32 mode;
|
||||||
__u16 flags;
|
__u16 flags;
|
||||||
__u32 count;
|
|
||||||
unsigned char *addr;
|
|
||||||
int len;
|
|
||||||
struct rtattr *rta;
|
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return;
|
return;
|
||||||
|
|
@ -176,48 +122,15 @@ static void macvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]
|
||||||
: mode == MACVLAN_MODE_VEPA ? "vepa"
|
: mode == MACVLAN_MODE_VEPA ? "vepa"
|
||||||
: mode == MACVLAN_MODE_BRIDGE ? "bridge"
|
: mode == MACVLAN_MODE_BRIDGE ? "bridge"
|
||||||
: mode == MACVLAN_MODE_PASSTHRU ? "passthru"
|
: mode == MACVLAN_MODE_PASSTHRU ? "passthru"
|
||||||
: mode == MACVLAN_MODE_SOURCE ? "source"
|
|
||||||
: "unknown");
|
: "unknown");
|
||||||
|
|
||||||
if (!tb[IFLA_MACVLAN_FLAGS] ||
|
if (!tb[IFLA_MACVLAN_FLAGS] ||
|
||||||
RTA_PAYLOAD(tb[IFLA_MACVLAN_FLAGS]) < sizeof(__u16))
|
RTA_PAYLOAD(tb[IFLA_MACVLAN_FLAGS]) < sizeof(__u16))
|
||||||
flags = 0;
|
return;
|
||||||
else
|
|
||||||
flags = rta_getattr_u16(tb[IFLA_MACVLAN_FLAGS]);
|
|
||||||
|
|
||||||
|
flags = rta_getattr_u16(tb[IFLA_MACVLAN_FLAGS]);
|
||||||
if (flags & MACVLAN_FLAG_NOPROMISC)
|
if (flags & MACVLAN_FLAG_NOPROMISC)
|
||||||
fprintf(f, "nopromisc ");
|
fprintf(f, "nopromisc ");
|
||||||
if (flags & MACVLAN_FLAG_UNICAST)
|
|
||||||
fprintf(f, "flag unicast ");
|
|
||||||
if (flags & MACVLAN_FLAG_UNICAST_ALL)
|
|
||||||
fprintf(f, "flag unicast_all ");
|
|
||||||
|
|
||||||
/* in source mode, there are more options to print */
|
|
||||||
|
|
||||||
if (mode != MACVLAN_MODE_SOURCE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!tb[IFLA_MACVLAN_MACADDR_COUNT] ||
|
|
||||||
RTA_PAYLOAD(tb[IFLA_MACVLAN_MACADDR_COUNT]) < sizeof(__u32))
|
|
||||||
return;
|
|
||||||
|
|
||||||
count = rta_getattr_u32(tb[IFLA_MACVLAN_MACADDR_COUNT]);
|
|
||||||
fprintf(f, " remotes (%d)", count);
|
|
||||||
|
|
||||||
if (!tb[IFLA_MACVLAN_MACADDR_DATA])
|
|
||||||
return;
|
|
||||||
|
|
||||||
rta = RTA_DATA(tb[IFLA_MACVLAN_MACADDR_DATA]);
|
|
||||||
len = RTA_PAYLOAD(tb[IFLA_MACVLAN_MACADDR_DATA]);
|
|
||||||
|
|
||||||
for (; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
|
|
||||||
if (rta->rta_type != IFLA_MACVLAN_MACADDR ||
|
|
||||||
RTA_PAYLOAD(rta) < 6)
|
|
||||||
continue;
|
|
||||||
addr = RTA_DATA(rta);
|
|
||||||
fprintf(f, " %.2x:%.2x:%.2x:%.2x:%.2x:%.2x", addr[0],
|
|
||||||
addr[1], addr[2], addr[3], addr[4], addr[5]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void macvlan_print_help(struct link_util *lu, int argc, char **argv,
|
static void macvlan_print_help(struct link_util *lu, int argc, char **argv,
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,6 @@ ip-link \- network device configuration
|
||||||
.IR NAME " ]"
|
.IR NAME " ]"
|
||||||
.br
|
.br
|
||||||
.RB "[ " addrgenmode " { " eui64 " | " none " | " stable_secret " | " random " } ]"
|
.RB "[ " addrgenmode " { " eui64 " | " none " | " stable_secret " | " random " } ]"
|
||||||
.br
|
|
||||||
.B macaddr " |"
|
|
||||||
.IR "COMMAND MACADDR |"
|
|
||||||
|
|
||||||
|
|
||||||
.ti -8
|
.ti -8
|
||||||
|
|
@ -240,46 +237,8 @@ Link types:
|
||||||
- IP over Infiniband device
|
- IP over Infiniband device
|
||||||
.sp
|
.sp
|
||||||
.B macvlan
|
.B macvlan
|
||||||
.I MODE
|
|
||||||
- Virtual interface base on link layer address (MAC)
|
- Virtual interface base on link layer address (MAC)
|
||||||
.sp
|
.sp
|
||||||
Modes:
|
|
||||||
.in +8
|
|
||||||
.B private
|
|
||||||
- The device never communicates with any other device on the same upper_dev.
|
|
||||||
This even includes frames coming back from a reflective relay, where supported
|
|
||||||
by the adjacent bridge.
|
|
||||||
.sp
|
|
||||||
.B vepa
|
|
||||||
- we assume that the adjacent bridge returns all frames where both source and
|
|
||||||
destination are local to the macvlan port, i.e. the bridge is set up as a
|
|
||||||
reflective relay. Broadcast frames coming in from the upper_dev get flooded to
|
|
||||||
all macvlan interfaces in VEPA mode. We never deliver any frames locally.
|
|
||||||
.sp
|
|
||||||
.B bridge
|
|
||||||
- behave as simple bridge between different macvlan interfaces on the same
|
|
||||||
port. Frames from one interface to another one get delivered directly and are
|
|
||||||
not sent out externally. Broadcast frames get flooded to all other bridge
|
|
||||||
ports and to the external interface, but when they come back from a reflective
|
|
||||||
relay, we don't deliver them again. Since we know all the MAC addresses, the
|
|
||||||
macvlan bridge mode does not require learning or STP like the bridge module
|
|
||||||
does.
|
|
||||||
.sp
|
|
||||||
.B passthru
|
|
||||||
- allows takeover of the underlying device and passing it to a guest using
|
|
||||||
virtio with macvtap backend. Only one macvlan device is allowed in passthru
|
|
||||||
mode and it inherits the mac address from the underlying device and sets it in
|
|
||||||
promiscuous mode to receive and forward all the packets.
|
|
||||||
.sp
|
|
||||||
.B source
|
|
||||||
- allows one to set a list of allowed mac address, which is used to match
|
|
||||||
against source mac address from received frames on underlying interface. This
|
|
||||||
allows creating mac based VLAN associations, instead of standard port or tag
|
|
||||||
based. The feature is useful to deploy 802.1x mac based behavior,
|
|
||||||
where drivers of underlying interfaces doesn't allows that.
|
|
||||||
.sp
|
|
||||||
.in -8
|
|
||||||
.sp
|
|
||||||
.B macvtap
|
.B macvtap
|
||||||
- Virtual interface based on link layer address (MAC) and TAP.
|
- Virtual interface based on link layer address (MAC) and TAP.
|
||||||
.sp
|
.sp
|
||||||
|
|
@ -1124,22 +1083,6 @@ specifies the type of the device.
|
||||||
|
|
||||||
.SS ip link set - change device attributes
|
.SS ip link set - change device attributes
|
||||||
|
|
||||||
.TP
|
|
||||||
.BI macaddr " COMMAND MACADDR"
|
|
||||||
add or removes MACADDR from allowed list for source mode macvlan type link
|
|
||||||
Commands:
|
|
||||||
.in +8
|
|
||||||
.B add
|
|
||||||
- add MACADDR to allowed list
|
|
||||||
.sp
|
|
||||||
.B del
|
|
||||||
- remove MACADDR from allowed list
|
|
||||||
.sp
|
|
||||||
.B flush
|
|
||||||
- flush whole allowed list
|
|
||||||
.sp
|
|
||||||
.in -8
|
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
.B Warning:
|
.B Warning:
|
||||||
If multiple parameter changes are requested,
|
If multiple parameter changes are requested,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue