Blob Blame History Raw
From 6c0e3f0160da03f50871e2e3692e3168f8c2a62b Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Tue, 28 Feb 2017 16:12:00 +0100
Subject: [PATCH] bridge: support for static fdb entries

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1417289
Upstream Status: iproute2.git commit a1987cd17fcb0

commit a1987cd17fcb042bd80f0dc2bf51941769fdb493
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date:   Wed Jan 27 09:09:37 2016 -0800

    bridge: support for static fdb entries

    There is no intuitive option to add static fdb entries today.
    'temp' seems to have a side effect of adding
    'static' fdb entries. But the name and intent
    of 'temp' does not say anything about it being static.

    example:
    bridge fdb add operates as follows:

    $bridge fdb add 00:01:02:03:04:05 dev eth0 master
    $bridge fdb add 00:01:02:03:04:06 dev eth0 master temp
    $bridge fdb add 00:01:02:03:04:07 dev eth0 master local

    $bridge fdb show
    00:01:02:03:04:05 dev eth0 permanent
    00:01:02:03:04:06 dev eth0 static
    00:01:02:03:04:07 dev eth0 permanent
    00:01:02:03:04:08 dev eth0 <<== dynamic, ageable learned mac

    This patch adds a new bridge fdb type 'static' which
    makes sure NUD_NOARP and NUD_REACHABLE is set for static
    entries. This effectively is nothing but what 'temp'
    does today. But the name 'temp' is misleading.

    After the patch:
    $bridge fdb add 00:01:02:03:04:06 dev eth0 master static

    $bridge fdb show
    00:01:02:03:04:06 dev eth0 static

    'temp' could ideally be a dynamic mac that can age (ie just
    NUD_REACHABLE). But, 'temp' sets 'NUD_NOARP' and 'NUD_REACHABLE'.
    Too late to change 'temp' now. But, we are thinking of introduing a
    'dynamic' keyword after this patch that only sets NUD_REACHABLE.

    Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
    Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 bridge/fdb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bridge/fdb.c b/bridge/fdb.c
index 8767c96..cb07345 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -32,7 +32,7 @@ static void usage(void)
 {
 	fprintf(stderr, "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n"
 			"              [ self ] [ master ] [ use ] [ router ]\n"
-			"              [ local | temp ] [ dst IPADDR ] [ vlan VID ]\n"
+			"              [ local | temp | static ] [ dst IPADDR ] [ vlan VID ]\n"
 		        "              [ port PORT] [ vni VNI ] [ via DEV ]\n");
 	fprintf(stderr, "       bridge fdb [ show [ br BRDEV ] [ brport DEV ] ]\n");
 	exit(-1);
@@ -300,7 +300,8 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
 		} else if (matches(*argv, "local") == 0||
 			   matches(*argv, "permanent") == 0) {
 			req.ndm.ndm_state |= NUD_PERMANENT;
-		} else if (matches(*argv, "temp") == 0) {
+		} else if (matches(*argv, "temp") == 0 ||
+			   matches(*argv, "static") == 0) {
 			req.ndm.ndm_state |= NUD_REACHABLE;
 		} else if (matches(*argv, "vlan") == 0) {
 			if (vid >= 0)
-- 
1.8.3.1