severity 438123 important
stop
On Wed, 15 Aug 2007, Michel Lespinasse wrote:
<snipp strace>
> These two calls got my attention:
> socket(PF_INET, SOCK_DGRAM, IPPROTO_TCP)
> socket(PF_INET, SOCK_STREAM, IPPROTO_UDP)
<snipp linux headers>
>
> the klibc source package also defines SOCK_DGRAM as 2 in
> usr/include/sys/socket.h
>
> I am using unmodified packages from etch.
urrgs indeed that got fixed postetch
ok i've build tested the attached git patch.
it builds fine under x86.
apt-get build-dep klibc
apt-get source klibc
mv 09-mips_sock_dgram.patch klibc-1.4.34/debian/patches
cd klibc-1.4.34
debuild
dpkg -i ../klibc-utils_* ../libklic_*
i'll talk with the stable rm if they'll approve it.
--
maks
commit 20720dcd78c8530e86a340a5b6aa8894fefdba88
Author: H. Peter Anvin <[EMAIL PROTECTED]>
Date: Tue Feb 27 19:02:25 2007 -0800
[klibc] Undo breakage caused by kernel header changes.
The kernel headers have hidden a bunch of stuff that used to be
exported. Compensate.
Signed-off-by: H. Peter Anvin <[EMAIL PROTECTED]>
diff --git a/usr/include/arch/mips/klibc/archconfig.h b/usr/include/arch/mips/klibc/archconfig.h
index 15b3208..ff0afb5 100644
--- a/usr/include/arch/mips/klibc/archconfig.h
+++ b/usr/include/arch/mips/klibc/archconfig.h
@@ -15,4 +15,7 @@
/* MIPS defines it's own statfs */
#define _KLIBC_STATFS_F_TYPE_32B 1
+/* MIPS has nonstandard socket definitions */
+#define _KLIBC_HAS_ARCHSOCKET_H 1
+
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/arch/mips/klibc/archsocket.h b/usr/include/arch/mips/klibc/archsocket.h
new file mode 100644
index 0000000..d6daf1b
--- /dev/null
+++ b/usr/include/arch/mips/klibc/archsocket.h
@@ -0,0 +1,17 @@
+/*
+ * arch/mips/klibc/archsocket.h
+ */
+
+#ifndef _KLIBC_ARCHSOCKET_H
+#define _KLIBC_ARCHSOCKET_H
+
+#ifndef SOCK_STREAM
+# define SOCK_DGRAM 1
+# define SOCK_STREAM 2
+# define SOCK_RAW 3
+# define SOCK_RDM 4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET 10
+#endif
+
+#endif /* _KLIBC_ARCHSOCKET_H */
diff --git a/usr/include/arch/mips64/klibc/archconfig.h b/usr/include/arch/mips64/klibc/archconfig.h
index b440af1..9071cb4 100644
--- a/usr/include/arch/mips64/klibc/archconfig.h
+++ b/usr/include/arch/mips64/klibc/archconfig.h
@@ -9,6 +9,7 @@
#ifndef _KLIBC_ARCHCONFIG_H
#define _KLIBC_ARCHCONFIG_H
-/* All defaults */
+/* MIPS has nonstandard socket definitions */
+#define _KLIBC_HAS_ARCHSOCKET_H 1
#endif /* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/arch/mips64/klibc/archsocket.h b/usr/include/arch/mips64/klibc/archsocket.h
new file mode 100644
index 0000000..6c3947d
--- /dev/null
+++ b/usr/include/arch/mips64/klibc/archsocket.h
@@ -0,0 +1,17 @@
+/*
+ * arch/mips64/klibc/archsocket.h
+ */
+
+#ifndef _KLIBC_ARCHSOCKET_H
+#define _KLIBC_ARCHSOCKET_H
+
+#ifndef SOCK_STREAM
+# define SOCK_DGRAM 1
+# define SOCK_STREAM 2
+# define SOCK_RAW 3
+# define SOCK_RDM 4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET 10
+#endif
+
+#endif /* _KLIBC_ARCHSOCKET_H */
index f4fb7a9..9c132d9 100644
--- a/usr/include/klibc/sysconfig.h
+++ b/usr/include/klibc/sysconfig.h
@@ -173,4 +174,14 @@
# define _KLIBC_STATFS_F_TYPE_32B 0
#endif
+
+/*
+ * _KLIBC_HAS_ARCHSOCKET_H
+ *
+ * This architecture has <klibc/archsocket.h>
+ */
+#ifndef _KLIBC_HAS_ARCHSOCKET_H
+# define _KLIBC_HAS_ARCHSOCKET_H 0
+#endif
+
#endif /* _KLIBC_SYSCONFIG_H */
diff --git a/usr/include/netinet/in.h b/usr/include/netinet/in.h
index 4ab7c24..2952bb2 100644
--- a/usr/include/netinet/in.h
+++ b/usr/include/netinet/in.h
@@ -5,12 +5,10 @@
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
-/* added this include by Mats Petersson */
-#include <linux/socket.h>
-
#include <klibc/extern.h>
#include <stdint.h>
#include <endian.h> /* Must be included *before* <linux/in.h> */
+#include <sys/socket.h> /* Must be included *before* <linux/in.h> */
#include <linux/in.h>
#ifndef htons
diff --git a/usr/include/sys/socket.h b/usr/include/sys/socket.h
index 2de1d6a..7d47087 100644
--- a/usr/include/sys/socket.h
+++ b/usr/include/sys/socket.h
@@ -7,9 +7,17 @@
#include <klibc/extern.h>
#include <klibc/compiler.h>
+#include <klibc/sysconfig.h>
#include <linux/socket.h>
+#if _KLIBC_HAS_ARCHSOCKET_H
+#include <klibc/archsocket.h>
+#endif
-/* For some reason these may be protected by __KERNEL__ in asm/socket.h */
+/* Great job, guys! These are *architecture-specific* ABI constants,
+ that are hidden under #ifdef __KERNEL__... what a brilliant idea!
+ These are the "common" definitions; if not appropriate, override
+ them in <klibc/archsocket.h>. */
+
#ifndef SOCK_STREAM
# define SOCK_STREAM 1
# define SOCK_DGRAM 2
diff --git a/usr/klibc/inet/inet_ntop.c b/usr/klibc/inet/inet_ntop.c
index ef31a18..106fb45 100644
--- a/usr/klibc/inet/inet_ntop.c
+++ b/usr/klibc/inet/inet_ntop.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in6.h>