99 lines
2.7 KiB
Text
99 lines
2.7 KiB
Text
$NetBSD: patch-an,v 1.5 2007/12/06 16:59:38 christos Exp $
|
|
|
|
--- net.c.orig 2006-12-13 14:57:23.000000000 -0500
|
|
+++ net.c 2007-12-06 11:54:11.000000000 -0500
|
|
@@ -35,7 +35,6 @@
|
|
#include <sys/stat.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/un.h>
|
|
-
|
|
#if defined(HAVE_SIN6_SCOPE_ID_LINUX)
|
|
#define in6_addr in6_addr_libc
|
|
#define ipv6_mreq ipv6_mreq_libc
|
|
@@ -43,12 +42,19 @@
|
|
#endif
|
|
|
|
#include <netinet/in.h>
|
|
-#ifdef HAVE_NETINET_TCP_H
|
|
+#if defined(HAVE_NETINET_TCP_H) || defined(NETBSD)
|
|
#include <netinet/tcp.h>
|
|
#endif
|
|
-#ifdef HAVE_NETINET_UDP_H
|
|
+#if defined(HAVE_NETINET_UDP_H) || defined(NETBSD)
|
|
#include <netinet/udp.h>
|
|
#endif
|
|
+#ifdef NETBSD
|
|
+#include <sys/param.h>
|
|
+#include <sys/ucred.h>
|
|
+#ifdef NETBSD
|
|
+#define ucred uucred
|
|
+#endif
|
|
+#endif
|
|
#include <arpa/inet.h>
|
|
#include <net/if.h>
|
|
#if defined(LINUX)
|
|
@@ -800,8 +806,12 @@
|
|
|
|
#ifdef SOL_PACKET
|
|
static const struct xlat sockpacketoptions[] = {
|
|
+#if defined(PACKET_ADD_MEMBERSHIP)
|
|
{ PACKET_ADD_MEMBERSHIP, "PACKET_ADD_MEMBERSHIP" },
|
|
+#endif
|
|
+#if defined(PACKET_DROP_MEMBERSHIP)
|
|
{ PACKET_DROP_MEMBERSHIP, "PACKET_DROP_MEMBERSHIP"},
|
|
+#endif
|
|
#if defined(PACKET_RECV_OUTPUT)
|
|
{ PACKET_RECV_OUTPUT, "PACKET_RECV_OUTPUT" },
|
|
#endif
|
|
@@ -1099,7 +1109,7 @@
|
|
return;
|
|
}
|
|
|
|
- tprintf(", {cmsg_len=%zu, cmsg_level=", cmsg->cmsg_len);
|
|
+ tprintf(", {cmsg_len=%zu, cmsg_level=", (size_t)cmsg->cmsg_len);
|
|
printxval(socketlayers, cmsg->cmsg_level, "SOL_???");
|
|
tprintf(", cmsg_type=");
|
|
|
|
@@ -1125,12 +1135,21 @@
|
|
free(cmsg);
|
|
return;
|
|
}
|
|
+#if !defined(SCM_CREDENTIALS) && defined(SCM_CREDS)
|
|
+#define SCM_CREDENTIALS SCM_CREDS
|
|
+#endif
|
|
+
|
|
if (cmsg->cmsg_type == SCM_CREDENTIALS
|
|
&& CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) {
|
|
struct ucred *uc = (struct ucred *) CMSG_DATA (cmsg);
|
|
|
|
+#ifdef NETBSD
|
|
+ tprintf("{uid=%ld, gid=%ld}}",
|
|
+ (long)uc->cr_uid, (long)uc->cr_gid);
|
|
+#else
|
|
tprintf("{pid=%ld, uid=%ld, gid=%ld}}",
|
|
(long)uc->pid, (long)uc->uid, (long)uc->gid);
|
|
+#endif
|
|
free(cmsg);
|
|
return;
|
|
}
|
|
@@ -1472,7 +1491,7 @@
|
|
else
|
|
tprintf("[%u, %u]", fds[0], fds[1]);
|
|
}
|
|
-#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(FREEBSD) || defined(IA64)
|
|
+#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(ALLBSD) || defined(IA64)
|
|
if (exiting(tcp))
|
|
tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
|
|
#endif
|
|
@@ -1519,9 +1538,9 @@
|
|
else
|
|
tprintf(", [%u, %u]", fds[0], fds[1]);
|
|
#endif /* LINUX */
|
|
-#if defined(SUNOS4) || defined(SVR4) || defined(FREEBSD)
|
|
+#if defined(SUNOS4) || defined(SVR4) || defined(ALLBSD)
|
|
tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp));
|
|
-#endif /* SUNOS4 || SVR4 || FREEBSD */
|
|
+#endif /* SUNOS4 || SVR4 || ALLBSD */
|
|
}
|
|
return 0;
|
|
}
|