]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: fix undefined bitshifts in netlink stuff
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 3 Jan 2020 21:39:57 +0000 (16:39 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 15 Jan 2020 17:51:58 +0000 (12:51 -0500)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/if_netlink.c
zebra/kernel_netlink.c

index 1ababec9bd1e175ae8350ed408947fdc247bdc58..f41f6e51ff8bd797cc220f8eb51f0f0ebe4b3e4b 100644 (file)
@@ -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)
index f52b4746ae7f0472dc9da9f0f7eb523a6781288f..890cb08c52e27421f6ea78c896d37357be1f68f4 100644 (file)
@@ -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);