]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/debug_nl.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / zebra / debug_nl.c
index a16d442521b185d0c39945c88908fbb706ba276c..df0b5aae7bb6092eb3d36914998e9c4965fae90f 100644 (file)
@@ -1,17 +1,6 @@
+// SPDX-License-Identifier: ISC
 /*
  * Copyright (c) 2018 Rafael Zalamena
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 #include <zebra.h>
@@ -1536,6 +1525,24 @@ next_rta:
        goto next_rta;
 }
 
+static const char *tcm_nltype2str(int nltype)
+{
+       switch (nltype) {
+       case RTM_NEWQDISC:
+       case RTM_DELQDISC:
+               return "qdisc";
+       case RTM_NEWTCLASS:
+       case RTM_DELTCLASS:
+               return "tclass";
+       case RTM_NEWTFILTER:
+       case RTM_DELTFILTER:
+               return "tfilter";
+       default:
+               /* should never hit */
+               return "unknown";
+       }
+}
+
 static void nlncm_dump(const struct netconfmsg *ncm, size_t msglen)
 {
        const struct rtattr *rta;
@@ -1595,6 +1602,8 @@ void nl_dump(void *msg, size_t msglen)
        struct ifinfomsg *ifi;
        struct tunnel_msg *tnlm;
        struct fib_rule_hdr *frh;
+       struct tcmsg *tcm;
+
        char fbuf[128];
        char ibuf[128];
 
@@ -1730,6 +1739,21 @@ next_header:
                nlncm_dump(ncm, nlmsg->nlmsg_len - NLMSG_LENGTH(sizeof(*ncm)));
                break;
 
+       case RTM_NEWQDISC:
+       case RTM_DELQDISC:
+       case RTM_NEWTCLASS:
+       case RTM_DELTCLASS:
+       case RTM_NEWTFILTER:
+       case RTM_DELTFILTER:
+               tcm = NLMSG_DATA(nlmsg);
+               zlog_debug(
+                       " tcm [type=%s family=%s (%d) ifindex=%d handle=%04x:%04x]",
+                       tcm_nltype2str(nlmsg->nlmsg_type),
+                       af_type2str(tcm->tcm_family), tcm->tcm_family,
+                       tcm->tcm_ifindex, tcm->tcm_handle >> 16,
+                       tcm->tcm_handle & 0xffff);
+               break;
+
        default:
                break;
        }