Browse Source

zebra: *addattr should use size_t len args, quell signed v unsigned warning

Paul Jakma 3 years ago
parent
commit
6f235418ad
3 changed files with 7 additions and 6 deletions
  1. 4 3
      zebra/rt_netlink.c
  2. 2 2
      zebra/rt_netlink.h
  3. 1 1
      zebra/zebra_fpm_netlink.c

+ 4 - 3
zebra/rt_netlink.c

@@ -1328,7 +1328,7 @@ netlink_route_read (struct zebra_vrf *zvrf)
 /* Utility function  comes from iproute2. 
    Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> */
 int
-addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, int alen)
+addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, size_t alen)
 {
   size_t len;
   struct rtattr *rta;
@@ -1348,9 +1348,10 @@ addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, int alen)
 }
 
 int
-rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen)
+rta_addattr_l (struct rtattr *rta, size_t maxlen, int type, void *data, 
+               size_t alen)
 {
-  int len;
+  size_t len;
   struct rtattr *subrta;
 
   len = RTA_LENGTH (alen);

+ 2 - 2
zebra/rt_netlink.h

@@ -30,10 +30,10 @@
 extern int
 addattr32 (struct nlmsghdr *n, size_t maxlen, int type, int data);
 extern int
-addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, int alen);
+addattr_l (struct nlmsghdr *n, size_t maxlen, int type, void *data, size_t alen);
 
 extern int
-rta_addattr_l (struct rtattr *rta, int maxlen, int type, void *data, int alen);
+rta_addattr_l (struct rtattr *rta, size_t maxlen, int type, void *data, size_t alen);
 
 extern const char *
 nl_msg_type_to_str (uint16_t msg_type);

+ 1 - 1
zebra/zebra_fpm_netlink.c

@@ -322,7 +322,7 @@ static int
 netlink_route_info_encode (netlink_route_info_t *ri, char *in_buf,
 			   size_t in_buf_len)
 {
-  int bytelen;
+  size_t bytelen;
   int nexthop_num = 0;
   size_t buf_offset;
   netlink_nh_info_t *nhi;