Bug 49389 - ping6.c uses kernel headers it shouldn't
ping6.c uses kernel headers it shouldn't
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: iputils (Show other bugs)
7.3
All Linux
medium Severity high
: ---
: ---
Assigned To: Phil Knirsch
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-07-18 18:25 EDT by David Woodhouse
Modified: 2015-03-04 20:09 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-12-21 10:53:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Woodhouse 2001-07-18 18:25:09 EDT
Description of Problem:

#include <asm/bitops.h>


I can understand iputils including some kernel headers but including
asm/bitops.h for clear_bit and test_bit is a little gratuitous and
non-portable. 

Please apply:

--- ping6.c	Thu Nov  2 19:42:59 2000
+++ ping6.c.fixed	Wed Jul 18 23:15:14 2001
@@ -83,10 +83,12 @@
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <asm/bitops.h>
 #include <linux/in6.h>
 #include <linux/ipv6.h>
 #include <linux/icmpv6.h>
+
+#define clear_bit(bit,adr) do{ *(unsigned long *)adr |= (1<<bit); } while(0)
+#define test_bit(bit,adr) (*(unsigned long *)adr | (1<<bit))
 
 #define ICMPV6_FILTER_WILLPASS(type, filterp) \
 	(test_bit(type, filterp) == 0)
Comment 1 David Woodhouse 2001-07-18 19:15:31 EDT
Or perhaps when I'm being slightly less stupid...

--- ping6.c	Thu Nov  2 19:42:59 2000
+++ ping6-fixed.c	Thu Jul 19 00:19:42 2001
@@ -83,10 +83,13 @@
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <asm/bitops.h>
 #include <linux/in6.h>
 #include <linux/ipv6.h>
 #include <linux/icmpv6.h>
+
+#define set_bit(nr, adr) do { ((unsigned char *)adr)[nr >> 3] |= (1U << (nr &
7)); } while(0)
+#define clear_bit(nr, adr) do { ((unsigned char *)adr)[nr >> 3] &= ~(1U << (nr
& 7)); } while(0)
+#define test_bit(nr, adr) ((((unsigned char *)adr)[nr >> 3])>>(nr & 7) & 1)
 
 #define ICMPV6_FILTER_WILLPASS(type, filterp) \
 	(test_bit(type, filterp) == 0)
Comment 2 Guy Streeter 2001-12-21 10:53:47 EST
This isn't just a problem with the beta. It prevents iputils for 7.2 from
buidling for ppc, because the ppc kernel headers protect clear_bit() with #ifdef
__KERNEL__.
Comment 3 Phil Knirsch 2002-03-12 08:36:06 EST
OK, fixed with latest iputils package.

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.