From: Quentin Young Date: Fri, 3 Jan 2020 21:39:57 +0000 (-0500) Subject: zebra: fix undefined bitshifts in netlink stuff X-Git-Tag: frr-7.2.1~4^2~7 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=cd2541ad6614eb0e0893faa8c67f7b396fef6bc4;p=matthieu%2Ffrr.git zebra: fix undefined bitshifts in netlink stuff Signed-off-by: Quentin Young --- diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index 1ababec9bd..f41f6e51ff 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -365,7 +365,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb, } } -static int get_iflink_speed(struct interface *interface) +static uint32_t get_iflink_speed(struct interface *interface) { struct ifreq ifdata; struct ethtool_cmd ecmd; @@ -410,7 +410,7 @@ static int get_iflink_speed(struct interface *interface) close(sd); - return (ecmd.speed_hi << 16) | ecmd.speed; + return ((uint32_t)ecmd.speed_hi << 16) | ecmd.speed; } uint32_t kernel_get_speed(struct interface *ifp) diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index f52b4746ae..890cb08c52 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -1074,7 +1074,7 @@ int netlink_request(struct nlsock *nl, struct nlmsghdr *n) netlink_socket (). */ void kernel_init(struct zebra_ns *zns) { - unsigned long groups; + uint32_t groups; #if defined SOL_NETLINK int one, ret; #endif @@ -1095,8 +1095,8 @@ void kernel_init(struct zebra_ns *zns) RTMGRP_IPV6_IFADDR | RTMGRP_IPV4_MROUTE | RTMGRP_NEIGH | - (1 << (RTNLGRP_IPV4_RULE - 1)) | - (1 << (RTNLGRP_IPV6_RULE - 1)); + ((uint32_t) 1 << (RTNLGRP_IPV4_RULE - 1)) | + ((uint32_t) 1 << (RTNLGRP_IPV6_RULE - 1)); snprintf(zns->netlink.name, sizeof(zns->netlink.name), "netlink-listen (NS %u)", zns->ns_id);