Bug 49389 - ping6.c uses kernel headers it shouldn't
Summary: ping6.c uses kernel headers it shouldn't
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: iputils   
(Show other bugs)
Version: 7.3
Hardware: All Linux
medium
high
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact: Aaron Brown
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-18 22:25 UTC by David Woodhouse
Modified: 2015-03-05 01:09 UTC (History)
1 user (show)

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


Attachments (Terms of Use)

Description David Woodhouse 2001-07-18 22:25:09 UTC
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 23:15:31 UTC
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 15:53:47 UTC
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 13:36:06 UTC
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.