X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=zebra%2Fif_netlink.c;h=588f1259cff3d222f2b2f402cc392b2f9a00bc90;hb=9df414feebc0748bbff2ea9071c76be59618e8e6;hp=a15d914243df9b27ca522edccaf77dc6dfe22c89;hpb=dca5ef30533ab2a7a5573f065537e7a05067bec7;p=mirror_frr.git diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index a15d91424..588f1259c 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -67,6 +67,7 @@ #include "zebra/zebra_mpls.h" #include "zebra/kernel_netlink.h" #include "zebra/if_netlink.h" +#include "zebra/zebra_errors.h" extern struct zebra_privs_t zserv_privs; @@ -112,8 +113,8 @@ static void netlink_interface_update_hw_addr(struct rtattr **tb, hw_addr_len = RTA_PAYLOAD(tb[IFLA_ADDRESS]); if (hw_addr_len > INTERFACE_HWADDR_MAX) - zlog_warn("Hardware address is too large: %d", - hw_addr_len); + zlog_debug("Hardware address is too large: %d", + hw_addr_len); else { ifp->hw_addr_len = hw_addr_len; memcpy(ifp->hw_addr, RTA_DATA(tb[IFLA_ADDRESS]), @@ -259,6 +260,8 @@ static void netlink_determine_zebra_iftype(char *kind, zebra_iftype_t *zif_type) *zif_type = ZEBRA_IF_VXLAN; else if (strcmp(kind, "macvlan") == 0) *zif_type = ZEBRA_IF_MACVLAN; + else if (strcmp(kind, "veth") == 0) + *zif_type = ZEBRA_IF_VETH; } #define parse_rtattr_nested(tb, max, rta) \ @@ -347,7 +350,8 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, vrf = vrf_lookup_by_id((vrf_id_t)ifi->ifi_index); if (!vrf) { - zlog_warn("%s: vrf not found", __func__); + flog_warn(ZEBRA_ERR_VRF_NOT_FOUND, "%s: vrf not found", + __func__); return; } @@ -529,7 +533,8 @@ static int netlink_bridge_interface(struct nlmsghdr *h, int len, ns_id_t ns_id, /* The interface should already be known, if not discard. */ ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), ifi->ifi_index); if (!ifp) { - zlog_warn("Cannot find bridge IF %s(%u)", name, ifi->ifi_index); + zlog_debug("Cannot find bridge IF %s(%u)", name, + ifi->ifi_index); return 0; } if (!IS_ZEBRA_IF_VXLAN(ifp)) @@ -675,7 +680,7 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup) SET_FLAG(ifp->status, ZEBRA_INTERFACE_VRF_LOOPBACK); /* Update link. */ - zebra_if_update_link(ifp, link_ifindex); + zebra_if_update_link(ifp, link_ifindex, ns_id); /* Hardware type and address. */ ifp->ll_type = netlink_to_zebra_link_type(ifi->ifi_type); @@ -894,7 +899,8 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup) ifa = NLMSG_DATA(h); if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) { - zlog_warn( + flog_warn( + ZEBRA_ERR_UNKNOWN_FAMILY, "Invalid address family: %u received from kernel interface addr change: %u", ifa->ifa_family, h->nlmsg_type); return 0; @@ -1128,14 +1134,15 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) /* assume if not default zns, then new VRF */ if (!(h->nlmsg_type == RTM_NEWLINK || h->nlmsg_type == RTM_DELLINK)) { /* If this is not link add/delete message so print warning. */ - zlog_warn("netlink_link_change: wrong kernel message %d", - h->nlmsg_type); + zlog_debug("netlink_link_change: wrong kernel message %d", + h->nlmsg_type); return 0; } if (!(ifi->ifi_family == AF_UNSPEC || ifi->ifi_family == AF_BRIDGE || ifi->ifi_family == AF_INET6)) { - zlog_warn( + flog_warn( + ZEBRA_ERR_UNKNOWN_FAMILY, "Invalid address family: %u received from kernel link change: %u", ifi->ifi_family, h->nlmsg_type); return 0; @@ -1246,7 +1253,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) set_ifindex(ifp, ifi->ifi_index, zns); ifp->flags = ifi->ifi_flags & 0x0000fffff; if (!tb[IFLA_MTU]) { - zlog_warn( + zlog_debug( "RTM_NEWLINK for interface %s(%u) without MTU set", name, ifi->ifi_index); return 0; @@ -1262,7 +1269,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) ZEBRA_INTERFACE_VRF_LOOPBACK); /* Update link. */ - zebra_if_update_link(ifp, link_ifindex); + zebra_if_update_link(ifp, link_ifindex, ns_id); netlink_interface_update_hw_addr(tb, ifp); @@ -1301,7 +1308,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) set_ifindex(ifp, ifi->ifi_index, zns); if (!tb[IFLA_MTU]) { - zlog_warn( + zlog_debug( "RTM_NEWLINK for interface %s(%u) without MTU set", name, ifi->ifi_index); return 0; @@ -1357,8 +1364,10 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup) } else { /* Delete interface notification from kernel */ if (ifp == NULL) { - zlog_warn("RTM_DELLINK for unknown interface %s(%u)", - name, ifi->ifi_index); + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug( + "RTM_DELLINK for unknown interface %s(%u)", + name, ifi->ifi_index); return 0; }