]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/rule_netlink.c
isisd: implement the 'lsp-too-large' notification
[mirror_frr.git] / zebra / rule_netlink.c
index bcffdf47221e9980a4eb7d18f076322112db7d0e..7686a0ac32bc6d22a2bf8c1b013dce83ffbd86b9 100644 (file)
@@ -40,6 +40,7 @@
 #include "zebra/kernel_netlink.h"
 #include "zebra/rule_netlink.h"
 #include "zebra/zebra_pbr.h"
+#include "zebra/zebra_errors.h"
 
 /* definitions */
 
@@ -142,31 +143,31 @@ static int netlink_rule_update(int cmd, struct zebra_pbr_rule *rule)
  * goes in the rule to denote relative ordering; it may or may not be the
  * same as the rule's user-defined sequence number.
  */
-enum dp_req_result kernel_add_pbr_rule(struct zebra_pbr_rule *rule)
+enum zebra_dplane_result kernel_add_pbr_rule(struct zebra_pbr_rule *rule)
 {
        int ret = 0;
 
        ret = netlink_rule_update(RTM_NEWRULE, rule);
        kernel_pbr_rule_add_del_status(rule,
-                                      (!ret) ? DP_INSTALL_SUCCESS
-                                             : DP_INSTALL_FAILURE);
+                                      (!ret) ? ZEBRA_DPLANE_INSTALL_SUCCESS
+                                             : ZEBRA_DPLANE_INSTALL_FAILURE);
 
-       return DP_REQUEST_SUCCESS;
+       return ZEBRA_DPLANE_REQUEST_SUCCESS;
 }
 
 /*
  * Uninstall specified rule for a specific interface.
  */
-enum dp_req_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule)
+enum zebra_dplane_result kernel_del_pbr_rule(struct zebra_pbr_rule *rule)
 {
        int ret = 0;
 
        ret = netlink_rule_update(RTM_DELRULE, rule);
        kernel_pbr_rule_add_del_status(rule,
-                                      (!ret) ? DP_DELETE_SUCCESS
-                                             : DP_DELETE_FAILURE);
+                                      (!ret) ? ZEBRA_DPLANE_DELETE_SUCCESS
+                                             : ZEBRA_DPLANE_DELETE_FAILURE);
 
-       return DP_REQUEST_SUCCESS;
+       return ZEBRA_DPLANE_REQUEST_SUCCESS;
 }
 
 /*
@@ -196,12 +197,21 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
                return 0;
 
        len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct fib_rule_hdr));
-       if (len < 0)
+       if (len < 0) {
+               zlog_err("%s: Message received from netlink is of a broken size: %d %zu",
+                        __PRETTY_FUNCTION__, h->nlmsg_len,
+                        (size_t)NLMSG_LENGTH(sizeof(struct fib_rule_hdr)));
                return -1;
+       }
 
        frh = NLMSG_DATA(h);
-       if (frh->family != AF_INET && frh->family != AF_INET6)
+       if (frh->family != AF_INET && frh->family != AF_INET6) {
+               flog_warn(
+                       EC_ZEBRA_NETLINK_INVALID_AF,
+                       "Invalid address family: %u received from kernel rule change: %u",
+                       frh->family, h->nlmsg_type);
                return 0;
+       }
        if (frh->action != FR_ACT_TO_TBL)
                return 0;