add DOVE extensions for iproute2
Subsystems (2)
PATCH 1/1 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".
Signed-off-by David L Stevens <[email protected]>
include/linux/if_link.h +1 -0
@@ -283,6 +283,7 @@ enum {IFLA_VXLAN_AGEING ,IFLA_VXLAN_LIMIT ,IFLA_VXLAN_PORT_RANGE , +IFLA_VXLAN_DOVE , __IFLA_VXLAN_MAX };#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
ip/iplink_vxlan.c +11 -0
@@ -26,6 +26,7 @@ static void explain(void)fprintf (stderr,"Usage: ... vxlan id VNI [ group ADDR ] [ local ADDR ]\n" );fprintf (stderr," [ ttl TTL ] [ tos TOS ] [ dev PHYS_DEV ]\n" );fprintf (stderr," [ port MIN MAX ] [ [no]learning ]\n" ); +fprintf (stderr," [ [no]dove]\n" );fprintf (stderr,"\n" );fprintf (stderr,"Where: VNI := 0-16777215\n" );fprintf (stderr," ADDR := { IP_ADDRESS | any }\n" );
@@ -44,6 +45,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,__u8 tos =0 ;__u8 ttl =0 ;__u8 learning =1 ; +__u8 dove =0 ;__u8 noage =0 ;__u32 age =0 ;__u32 maxaddr =0 ;
@@ -123,6 +125,10 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv, learning =0 ; }else if (!matches (*argv,"learning" )) { learning =1 ; + }else if (!matches (*argv,"nodove" )) { + dove =0 ; + }else if (!matches (*argv,"dove" )) { + dove =1 ; }else if (matches (*argv,"help" ) ==0 ) {explain ();return -1 ;
@@ -148,6 +154,7 @@ 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_TOS , tos);addattr8 (n,1024 ,IFLA_VXLAN_LEARNING , learning); +addattr8 (n,1024 ,IFLA_VXLAN_DOVE , dove);if (noage)addattr32 (n,1024 ,IFLA_VXLAN_AGEING ,0 );else if (age)
@@ -213,6 +220,10 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])if (tb[IFLA_VXLAN_LEARNING ] && !rta_getattr_u8 (tb[IFLA_VXLAN_LEARNING ]))fputs ("nolearning " , f); + +if (tb[IFLA_VXLAN_DOVE ] && +rta_getattr_u8 (tb[IFLA_VXLAN_DOVE ])) +fputs ("dove " , f);if (tb[IFLA_VXLAN_TOS ] && (tos =rta_getattr_u8 (tb[IFLA_VXLAN_TOS ]))) {
ip/ipmonitor.c +2 -1
@@ -67,7 +67,8 @@ int accept_msg(const struct sockaddr_nl *who,print_addrlabel (who, n, arg);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)fprintf (fp,"[NEIGH]" );print_neigh (who, n, arg);
ip/ipneigh.c +4 -1
@@ -189,7 +189,8 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)struct rtattr * tb[NDA_MAX +1 ];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" , 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 )fprintf (fp,"delete " ); +else if (n->nlmsg_type ==RTM_GETNEIGH ) +fprintf (fp,"miss " );if (tb[NDA_DST ]) { fprintf(fp, "%s ", format_host(r->ndm_family,