summaryrefslogtreecommitdiffstats
path: root/zebra/rule_netlink.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-02-16 03:34:04 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-03-09 17:07:41 +0100
commit43fe6a2a7377d7a214bcc0afd599edd697a44e5d (patch)
tree51790f6bb6edfcc6d86adfb3ed3e4126f85f8da9 /zebra/rule_netlink.c
parentzebra: Cleanup api (diff)
downloadfrr-43fe6a2a7377d7a214bcc0afd599edd697a44e5d.tar.xz
frr-43fe6a2a7377d7a214bcc0afd599edd697a44e5d.zip
zebra: Keep track of rules written
Keep track of rules written into the kernel. This will allow us to delete them on shutdown if we are not cleaned up properly. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/rule_netlink.c')
-rw-r--r--zebra/rule_netlink.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c
index 3228d0e4b..c64d9f6ab 100644
--- a/zebra/rule_netlink.c
+++ b/zebra/rule_netlink.c
@@ -85,8 +85,9 @@ static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule,
addattr32(&req.n, sizeof(req), FRA_PRIORITY, rule->priority);
/* interface on which applied */
- addattr_l(&req.n, sizeof(req), FRA_IFNAME, ifp->name,
- strlen(ifp->name)+1);
+ if (ifp)
+ addattr_l(&req.n, sizeof(req), FRA_IFNAME, ifp->name,
+ strlen(ifp->name) + 1);
/* source IP, if specified */
if (IS_RULE_FILTERING_ON_SRC_IP(rule)) {
@@ -114,7 +115,8 @@ static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule,
zlog_debug(
"Tx %s family %s IF %s(%u) Pref %u Src %s Dst %s Table %u",
nl_msg_type_to_str(cmd), nl_family_to_str(family),
- ifp->name, ifp->ifindex, rule->priority,
+ ifp ? ifp->name : "Unknown", ifp ? ifp->ifindex : 0,
+ rule->priority,
prefix2str(&rule->filter.src_ip, buf1, sizeof(buf1)),
prefix2str(&rule->filter.dst_ip, buf2, sizeof(buf2)),
rule->action.table);