nwrap: use symbols IPPROTO_TCP and IPPROTO_UDP
authorMichael Adam <obnox@samba.org>
Thu, 12 Nov 2015 10:08:47 +0000 (11:08 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:31 +0000 (12:25 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/nss_wrapper/nss_wrapper.c

index 429102aadfa136a9c11d645ecb1c633cc5ae35d5..38866f19202e093171e91e9393c8c003e6934142 100644 (file)
@@ -52,6 +52,8 @@
 #include <unistd.h>
 #include <ctype.h>
 
+#include <netinet/in.h>
+
 #include <search.h>
 #include <assert.h>
 
@@ -5249,9 +5251,9 @@ valid_port:
                ai->ai_socktype = SOCK_DGRAM;
        }
        if (ai->ai_protocol == 0 && ai->ai_socktype == SOCK_DGRAM) {
-               ai->ai_protocol = 17; /* UDP */
+               ai->ai_protocol = IPPROTO_UDP;
        } else if (ai->ai_protocol == 0 && ai->ai_socktype == SOCK_STREAM) {
-               ai->ai_protocol = 6; /* TCP */
+               ai->ai_protocol = IPPROTO_TCP;
        }
 
        if (hints->ai_socktype == 0) {
@@ -5284,10 +5286,11 @@ valid_port:
                                ai_tmp->ai_socktype = SOCK_DGRAM;
                        }
                        if (ai_head->ai_socktype == SOCK_DGRAM) {
-                               ai_tmp->ai_protocol = 17; /* UDP */
+                               ai_tmp->ai_protocol = IPPROTO_UDP;
                        } else if (ai_head->ai_socktype == SOCK_STREAM) {
-                               ai_tmp->ai_protocol = 6; /* TCP */
+                               ai_tmp->ai_protocol = IPPROTO_TCP;
                        }
+
                        ai_new_tail->ai_next = ai_tmp;
                        ai_new_tail = ai_tmp;