summaryrefslogtreecommitdiffstats
path: root/zebra/rule_netlink.c
diff options
context:
space:
mode:
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);