add DOVE extensions for iproute2
This patch adds a new flag to iproute2 for vxlan devices to enable DOVE features. It also adds support for L2 and L3 switch lookup miss netlink messages to "ip monitor". Changes since v2: fix merge conflict Changes since v1: - split "dove" flag into separate feature flags: - "proxy" for ARP reduction - "rsc" for route short circuiting - "l2miss" for L2 switch miss notifications - "l3miss" for L3 switch miss notifications Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
This commit is contained in:
parent
1ce2de9738
commit
1556e29d3c
|
|
@ -26,6 +26,8 @@ static void explain(void)
|
||||||
fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
|
fprintf(stderr, "Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n");
|
||||||
fprintf(stderr, " [ ttl TTL ] [ tos TOS ] [ dev PHYS_DEV ]\n");
|
fprintf(stderr, " [ ttl TTL ] [ tos TOS ] [ dev PHYS_DEV ]\n");
|
||||||
fprintf(stderr, " [ port MIN MAX ] [ [no]learning ]\n");
|
fprintf(stderr, " [ port MIN MAX ] [ [no]learning ]\n");
|
||||||
|
fprintf(stderr, " [ [no]proxy ] [ [no]rsc ]\n");
|
||||||
|
fprintf(stderr, " [ [no]l2miss ] [ [no]l3miss ]\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "Where: VNI := 0-16777215\n");
|
fprintf(stderr, "Where: VNI := 0-16777215\n");
|
||||||
fprintf(stderr, " ADDR := { IP_ADDRESS | any }\n");
|
fprintf(stderr, " ADDR := { IP_ADDRESS | any }\n");
|
||||||
|
|
@ -44,6 +46,10 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
__u8 tos = 0;
|
__u8 tos = 0;
|
||||||
__u8 ttl = 0;
|
__u8 ttl = 0;
|
||||||
__u8 learning = 1;
|
__u8 learning = 1;
|
||||||
|
__u8 proxy = 0;
|
||||||
|
__u8 rsc = 0;
|
||||||
|
__u8 l2miss = 0;
|
||||||
|
__u8 l3miss = 0;
|
||||||
__u8 noage = 0;
|
__u8 noage = 0;
|
||||||
__u32 age = 0;
|
__u32 age = 0;
|
||||||
__u32 maxaddr = 0;
|
__u32 maxaddr = 0;
|
||||||
|
|
@ -123,6 +129,22 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
learning = 0;
|
learning = 0;
|
||||||
} else if (!matches(*argv, "learning")) {
|
} else if (!matches(*argv, "learning")) {
|
||||||
learning = 1;
|
learning = 1;
|
||||||
|
} else if (!matches(*argv, "noproxy")) {
|
||||||
|
proxy = 0;
|
||||||
|
} else if (!matches(*argv, "proxy")) {
|
||||||
|
proxy = 1;
|
||||||
|
} else if (!matches(*argv, "norsc")) {
|
||||||
|
rsc = 0;
|
||||||
|
} else if (!matches(*argv, "rsc")) {
|
||||||
|
rsc = 1;
|
||||||
|
} else if (!matches(*argv, "nol2miss")) {
|
||||||
|
l2miss = 0;
|
||||||
|
} else if (!matches(*argv, "l2miss")) {
|
||||||
|
l2miss = 1;
|
||||||
|
} else if (!matches(*argv, "nol3miss")) {
|
||||||
|
l3miss = 0;
|
||||||
|
} else if (!matches(*argv, "l3miss")) {
|
||||||
|
l3miss = 1;
|
||||||
} else if (matches(*argv, "help") == 0) {
|
} else if (matches(*argv, "help") == 0) {
|
||||||
explain();
|
explain();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -148,6 +170,10 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
|
addattr8(n, 1024, IFLA_VXLAN_TTL, ttl);
|
||||||
addattr8(n, 1024, IFLA_VXLAN_TOS, tos);
|
addattr8(n, 1024, IFLA_VXLAN_TOS, tos);
|
||||||
addattr8(n, 1024, IFLA_VXLAN_LEARNING, learning);
|
addattr8(n, 1024, IFLA_VXLAN_LEARNING, learning);
|
||||||
|
addattr8(n, 1024, IFLA_VXLAN_PROXY, proxy);
|
||||||
|
addattr8(n, 1024, IFLA_VXLAN_RSC, rsc);
|
||||||
|
addattr8(n, 1024, IFLA_VXLAN_L2MISS, l2miss);
|
||||||
|
addattr8(n, 1024, IFLA_VXLAN_L3MISS, l3miss);
|
||||||
if (noage)
|
if (noage)
|
||||||
addattr32(n, 1024, IFLA_VXLAN_AGEING, 0);
|
addattr32(n, 1024, IFLA_VXLAN_AGEING, 0);
|
||||||
else if (age)
|
else if (age)
|
||||||
|
|
@ -190,7 +216,7 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
if (tb[IFLA_VXLAN_LOCAL]) {
|
if (tb[IFLA_VXLAN_LOCAL]) {
|
||||||
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]);
|
__be32 addr = rta_getattr_u32(tb[IFLA_VXLAN_LOCAL]);
|
||||||
if (addr)
|
if (addr)
|
||||||
fprintf(f, "local %s ",
|
fprintf(f, "local %s ",
|
||||||
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
|
format_host(AF_INET, 4, &addr, s1, sizeof(s1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,12 +234,24 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
const struct ifla_vxlan_port_range *r
|
const struct ifla_vxlan_port_range *r
|
||||||
= RTA_DATA(tb[IFLA_VXLAN_PORT_RANGE]);
|
= RTA_DATA(tb[IFLA_VXLAN_PORT_RANGE]);
|
||||||
fprintf(f, "port %u %u ", ntohs(r->low), ntohs(r->high));
|
fprintf(f, "port %u %u ", ntohs(r->low), ntohs(r->high));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[IFLA_VXLAN_LEARNING] &&
|
if (tb[IFLA_VXLAN_LEARNING] &&
|
||||||
!rta_getattr_u8(tb[IFLA_VXLAN_LEARNING]))
|
!rta_getattr_u8(tb[IFLA_VXLAN_LEARNING]))
|
||||||
fputs("nolearning ", f);
|
fputs("nolearning ", f);
|
||||||
|
|
||||||
|
if (tb[IFLA_VXLAN_PROXY] && rta_getattr_u8(tb[IFLA_VXLAN_PROXY]))
|
||||||
|
fputs("proxy ", f);
|
||||||
|
|
||||||
|
if (tb[IFLA_VXLAN_RSC] && rta_getattr_u8(tb[IFLA_VXLAN_RSC]))
|
||||||
|
fputs("rsc ", f);
|
||||||
|
|
||||||
|
if (tb[IFLA_VXLAN_L2MISS] && rta_getattr_u8(tb[IFLA_VXLAN_L2MISS]))
|
||||||
|
fputs("l2miss ", f);
|
||||||
|
|
||||||
|
if (tb[IFLA_VXLAN_L3MISS] && rta_getattr_u8(tb[IFLA_VXLAN_L3MISS]))
|
||||||
|
fputs("l3miss ", f);
|
||||||
|
|
||||||
if (tb[IFLA_VXLAN_TOS] &&
|
if (tb[IFLA_VXLAN_TOS] &&
|
||||||
(tos = rta_getattr_u8(tb[IFLA_VXLAN_TOS]))) {
|
(tos = rta_getattr_u8(tb[IFLA_VXLAN_TOS]))) {
|
||||||
if (tos == 1)
|
if (tos == 1)
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,8 @@ int accept_msg(const struct sockaddr_nl *who,
|
||||||
print_addrlabel(who, n, arg);
|
print_addrlabel(who, n, arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH) {
|
if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH ||
|
||||||
|
n->nlmsg_type == RTM_GETNEIGH) {
|
||||||
if (prefix_banner)
|
if (prefix_banner)
|
||||||
fprintf(fp, "[NEIGH]");
|
fprintf(fp, "[NEIGH]");
|
||||||
print_neigh(who, n, arg);
|
print_neigh(who, n, arg);
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,8 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||||
struct rtattr * tb[NDA_MAX+1];
|
struct rtattr * tb[NDA_MAX+1];
|
||||||
char abuf[256];
|
char abuf[256];
|
||||||
|
|
||||||
if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH) {
|
if (n->nlmsg_type != RTM_NEWNEIGH && n->nlmsg_type != RTM_DELNEIGH &&
|
||||||
|
n->nlmsg_type != RTM_GETNEIGH) {
|
||||||
fprintf(stderr, "Not RTM_NEWNEIGH: %08x %08x %08x\n",
|
fprintf(stderr, "Not RTM_NEWNEIGH: %08x %08x %08x\n",
|
||||||
n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
|
n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
|
||||||
|
|
||||||
|
|
@ -251,6 +252,8 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
||||||
|
|
||||||
if (n->nlmsg_type == RTM_DELNEIGH)
|
if (n->nlmsg_type == RTM_DELNEIGH)
|
||||||
fprintf(fp, "delete ");
|
fprintf(fp, "delete ");
|
||||||
|
else if (n->nlmsg_type == RTM_GETNEIGH)
|
||||||
|
fprintf(fp, "miss ");
|
||||||
if (tb[NDA_DST]) {
|
if (tb[NDA_DST]) {
|
||||||
fprintf(fp, "%s ",
|
fprintf(fp, "%s ",
|
||||||
format_host(r->ndm_family,
|
format_host(r->ndm_family,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue