[SSSD] [PATCH] UTIL: Include netinet/in.h for ip adress macros

Lukas Slebodnik lslebodn at redhat.com
Sat May 24 17:11:14 UTC 2014


ehlo,

The manual page in.h (man in.h) says:
   The <netinet/in.h> header shall define the in6_addr structure that con‐
   tains at least the following member:
                    uint8_t s6_addr[16]
   The  <netinet/in.h>  header shall define the following macros that test
   for special IPv6 addresses. Each macro is of type int and takes a  sin‐
   gle argument of type const struct in6_addr *:
        IN6_IS_ADDR_LINKLOCAL: Unicast link-local address.
        IN6_IS_ADDR_LOOPBACK: Loopback address.
        IN6_IS_ADDR_MULTICAST: Multicast address.

The header file netinet/in.h> was not included directly in src/util/util.c
and it caused few problems.

LS
-------------- next part --------------
>From 86a5424be5843e34bf62de9989df113af71d03ea Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lukas.slebodnik at intrak.sk>
Date: Sat, 24 May 2014 13:54:31 +0200
Subject: [PATCH 6/6] UTIL: Include netinet/in.h for ip adress macros
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The manual page in.h (man in.h) says:
   The <netinet/in.h> header shall define the in6_addr structure that con‐
   tains at least the following member:
                    uint8_t s6_addr[16]
   The  <netinet/in.h>  header shall define the following macros that test
   for special IPv6 addresses. Each macro is of type int and takes a  sin‐
   gle argument of type const struct in6_addr *:
        IN6_IS_ADDR_LINKLOCAL: Unicast link-local address.
        IN6_IS_ADDR_LOOPBACK: Loopback address.
        IN6_IS_ADDR_MULTICAST: Multicast address.

The header file netinet/in.h> was not included directly in src/util/util.c
and it caused few problems.

./src/util/util.h:378: warning: 'struct in6_addr' declared inside parameter list
./src/util/util.h:378: warning: its scope is only this definition or declaration, which is probably not what you want
src/util/util.c: In function 'check_ipv4_addr':
src/util/util.c:765: error: implicit declaration of function 'IN_MULTICAST'
src/util/util.c:769: error: 'IN_LOOPBACKNET' undeclared (first use in this function)
src/util/util.c:769: error: (Each undeclared identifier is reported only once
src/util/util.c:769: error: for each function it appears in.)
src/util/util.c:778: error: 'INADDR_BROADCAST' undeclared (first use in this function)
src/util/util.c: At top level:
src/util/util.c:786: warning: 'struct in6_addr' declared inside parameter list
src/util/util.c:787: error: conflicting types for 'check_ipv6_addr'
./src/util/util.h:378: error: previous declaration of 'check_ipv6_addr' was here
src/util/util.c: In function 'check_ipv6_addr':
src/util/util.c:796: error: implicit declaration of function 'IN6_IS_ADDR_LINKLOCAL'
src/util/util.c:799: error: implicit declaration of function 'IN6_IS_ADDR_LOOPBACK'
src/util/util.c:802: error: implicit declaration of function 'IN6_IS_ADDR_MULTICAST'
---
 src/util/util.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/util.h b/src/util/util.h
index 54c6c6c78b87398da66e276d67a04f4558cec790..f682f50feb362f0cb13ff4503753abdb431b21ab 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -38,6 +38,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 
 #include <talloc.h>
 #include <tevent.h>
-- 
1.9.3



More information about the sssd-devel mailing list