[PATCH 1/2] netlink: fix const-correctness of ip_fast_csum fallback

Ian Jackson ijackson at chiark.greenend.org.uk
Wed May 7 18:48:48 BST 2014

211cd627 corrected the constness of ip_csum and ip_fast_csum.  But the
latter has two implementations, and we missed the C fallback.  This
resulted in the following compile error on non-i386 platforms:
  netlink.c:606:2: error: passing argument 1 of `ip_fast_csum'
  discards `const' qualifier from pointer target type [-Werror]

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
CC: Stephen Early <sde at individualpubs.co.uk>
 netlink.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/netlink.c b/netlink.c
index 50a920f..ea1221d 100644
--- a/netlink.c
+++ b/netlink.c
@@ -180,7 +180,7 @@ static inline uint16_t ip_fast_csum(const uint8_t *iph, int32_t ihl) {
     return sum;
-static inline uint16_t ip_fast_csum(uint8_t *iph, int32_t ihl)
+static inline uint16_t ip_fast_csum(const uint8_t *iph, int32_t ihl)
     assert(ihl < INT_MAX/4);
     return ip_csum(iph,ihl*4);

More information about the sgo-software-discuss mailing list