]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix undefined bitshifts in netlink stuff 5619/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 3 Jan 2020 21:39:57 +0000 (16:39 -0500)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Sat, 4 Jan 2020 19:12:46 +0000 (14:12 -0500)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/if_netlink.c
zebra/kernel_netlink.c

index c09007bcb1d26bf5fdf4fdc355bc002b61276997..eae5d2b854f6201f56ffd4a617d08bdedc255e5f 100644 (file)
@@ -366,7 +366,7 @@ static void netlink_vrf_change(struct nlmsghdr *h, struct rtattr *tb,
        }
 }
 
-static int get_iflink_speed(struct interface *interface, int *error)
+static uint32_t get_iflink_speed(struct interface *interface, int *error)
 {
        struct ifreq ifdata;
        struct ethtool_cmd ecmd;
@@ -419,7 +419,7 @@ static int get_iflink_speed(struct interface *interface, int *error)
 
        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, int *error)
index 23f1a3bf86ca61a5cbca8a26735dade8f6f7a1ff..3bceb56359e2c9a7c19c03d9832f32cf15c115b3 100644 (file)
@@ -1086,7 +1086,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
@@ -1107,9 +1107,9 @@ 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)) |
-               (1 << (RTNLGRP_NEXTHOP - 1));
+               ((uint32_t) 1 << (RTNLGRP_IPV4_RULE - 1)) |
+               ((uint32_t) 1 << (RTNLGRP_IPV6_RULE - 1)) |
+               ((uint32_t) 1 << (RTNLGRP_NEXTHOP - 1));
 
        snprintf(zns->netlink.name, sizeof(zns->netlink.name),
                 "netlink-listen (NS %u)", zns->ns_id);