Modify

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#3737 closed defect (fixed)

radvd doesn't work on 2.4

Reported by: alex@… Owned by: developers
Priority: normal Milestone: Bugs Paradise
Component: packages Version:
Keywords: Cc:

Description (last modified by nico)

There is a problem with running radvd with the 2.4 kernel, it is compiled with options for he 2.6 kernel.

strace radvd

socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6) = 4
setsockopt(4, SOL_IPV6, 0x31 /* IPV6_??? */, [1], 4) = -1 ENOPROTOOPT (Protocol not available)

from the source socket.c

#if defined IPV6_PKTINFO && !defined IPV6_RECVPKTINFO
# define IPV6_RECVPKTINFO IPV6_PKTINFO
#endif

it seems as if IPV6_PKTINFO is not being defined it is available in 2.4 were as IPV6_RECVPKTINFO isn't

the make needs to define IPV6_PKTINFO (and undefine IPV6_RECVPKTINFO)

Attachments (0)

Change History (20)

comment:1 Changed 10 years ago by anonymous

Sorry, I spoke to early it is not the IPV6_RECVPKTINFO, I recompile and it still errored out.

comment:2 Changed 10 years ago by alex@…

Some more investigation and the problem is in the libraries being used.

I believe from include in.h

the values for IPV6_PKTINFO is differnent from original, when i place #defines in the socket.c for the proper values (gotten from the linux source) it loads. But then there are other errors and it doesn't work properly

I will investigate further

comment:3 Changed 10 years ago by alex@…

It seems like there are some discrepancies with the library and linux.

 grep -Hsr PKTINFO *
bits/in.h:#define IP_PKTINFO         8  /* bool */
bits/in.h:/* Structure used for IP_PKTINFO.  */
bits/in.h:#define IPV6_2292PKTINFO      2
bits/in.h:#define IPV6_RECVPKTINFO      49
bits/in.h:#define IPV6_PKTINFO          50
linux/in.h:#define IP_PKTINFO   8
linux/in6.h:#define IPV6_PKTINFO                2

as you can see there are different values for IPV6_PKTINFO 50 and 2. 50 is used for 2.6 kernel and 2 is used for 2.4.

Note sure how to make the change for radvd, ie to select which version

comment:4 Changed 9 years ago by nico

  • Description modified (diff)
  • Milestone set to Kamikaze Bugs Paradize

comment:5 Changed 9 years ago by zioproto@…

I confirm the bug is reproducible

root@melanzana:/tmp# radvd
[Jan 01 00:54:04] radvd: setsockopt(IPV6_RECVPKTINFO): Protocol not available
root@melanzana:/tmp# 

but IPv6 is okay and working

root@melanzana:/tmp# ip addr show wl0
6: wl0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:13:10:14:dc:44 brd ff:ff:ff:ff:ff:ff
    inet 172.16.254.19/16 brd 172.16.255.255 scope global wl0
    inet6 2001:5c0:9f60:0:213:10ff:fe14:dc44/128 scope global 
    inet6 fe80::213:10ff:fe14:dc44/64 scope link 
root@melanzana:/tmp# 

comment:6 Changed 9 years ago by kd8ikt

affecting RC1 8.09 :(

comment:7 follow-up: Changed 9 years ago by anonymous

maybe missing sit or tun kmod?

comment:8 in reply to: ↑ 7 Changed 9 years ago by anonymous

Replying to anonymous:

maybe missing sit or tun kmod?

nope, both sit and tun devices are created properly

comment:9 Changed 9 years ago by bjoern.riemer@…

this fixes radvd fot the 2.4 kernel...

diff -u radvd-1.1/socket.c radvd-1.1-bri/socket.c
--- radvd-1.1/socket.c  2005-10-18 21:22:00.000000000 +0200
+++ radvd-1.1-bri/socket.c      2008-11-19 17:40:37.000000000 +0100
@@ -26,7 +26,10 @@
 #if defined IPV6_PKTINFO && !defined IPV6_RECVPKTINFO
 # define IPV6_RECVPKTINFO IPV6_PKTINFO
 #endif
-
+#define IPV6_PKTINFO 2
+#define IPV6_RECVPKTINFO IPV6_PKTINFO
+#define IPV6_HOPLIMIT 8
+#define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT
 int
 open_icmpv6_socket(void)
 {

comment:10 Changed 9 years ago by bjoern.riemer@…

now its working...

diff -u radvd-1.1/includes.h radvd-1.1-bri/includes.h
--- radvd-1.1/includes.h        2007-10-25 21:29:40.000000000 +0200
+++ radvd-1.1-bri/includes.h    2008-11-19 18:21:23.000000000 +0100
@@ -99,4 +99,6 @@
 # include <ifaddrs.h>
 #endif

+#define IPV6_PKTINFO 2
+
 #endif /* INCLUDES_H */
Common subdirectories: radvd-1.1/redhat and radvd-1.1-bri/redhat
diff -u radvd-1.1/socket.c radvd-1.1-bri/socket.c
--- radvd-1.1/socket.c  2005-10-18 21:22:00.000000000 +0200
+++ radvd-1.1-bri/socket.c      2008-11-19 18:00:04.000000000 +0100
@@ -27,6 +27,12 @@
 # define IPV6_RECVPKTINFO IPV6_PKTINFO
 #endif

+#define IPV6_PKTINFO 2
+#define IPV6_RECVPKTINFO IPV6_PKTINFO
+//#define IPV6_HOPLIMIT 8
+//#define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT
+#undef IPV6_RECVHOPLIMIT
+
 int
 open_icmpv6_socket(void)
 {

comment:11 Changed 9 years ago by anonymous

has this fix been confirmed and made it into the nightly builds yet?

comment:12 Changed 9 years ago by bjoern.riemer@…

i don't think so.. this fix only works on an 2.4.x kernel.. it breaks compatibility with 2.6.x kernels..
only apply this patch for 2.4

comment:13 Changed 9 years ago by Floppe

Maybe define things after detected kernel?

Have not tested this patch with 2.6 kernel, but it seems to work with 2.4.

003-kernel_detect.patch

diff -ur radvd-1.2.orig/includes.h radvd-1.2/includes.h
--- radvd-1.2.orig/includes.h   2007-10-25 22:29:40.000000000 +0300
+++ radvd-1.2/includes.h        2008-12-30 09:12:03.000000000 +0200
@@ -99,4 +99,16 @@
 # include <ifaddrs.h>
 #endif

+#include <linux/version.h>
+#ifndef KERNEL_VERSION
+# define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+# define KERNEL_24
+# define IPV6_PKTINFO 2
+# define IPV6_RECVPKTINFO IPV6_PKTINFO
+# undef IPV6_RECVHOPLIMIT
+#endif
+
 #endif /* INCLUDES_H */
diff -ur radvd-1.2.orig/socket.c radvd-1.2/socket.c
--- radvd-1.2.orig/socket.c     2005-10-18 22:22:00.000000000 +0300
+++ radvd-1.2/socket.c  2008-12-30 08:48:16.000000000 +0200
@@ -19,7 +19,7 @@
 #include <radvd.h>

 /* Note: these are applicable to receiving sockopts only */
-#if defined IPV6_HOPLIMIT && !defined IPV6_RECVHOPLIMIT
+#if defined IPV6_HOPLIMIT && !defined IPV6_RECVHOPLIMIT && !defined KERNEL_24
 # define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT
 #endif

comment:14 follow-up: Changed 9 years ago by anonymous

so .. how to recompile the package?
dont want to reinstall the snapshot i took 2 days ago ..

any compiled patched radvd? or can one tell me howto recompile just the package/feed?

comment:15 in reply to: ↑ 14 Changed 9 years ago by anonymous

Replying to anonymous:

so .. how to recompile the package?
dont want to reinstall the snapshot i took 2 days ago ..

any compiled patched radvd? or can one tell me howto recompile just the package/feed?

me again.. sry for the disturbance ... got it running with snapshot radvd

comment:16 Changed 9 years ago by pekkas@…

Hi, I'm the maintainer of radvd package. I spotted this problem while working on another similar issue. You could try the patch at http://netcore.fi/pekkas/linux/radvd-libc-kernel-build-detect.patch. You will need to regenerate configure and config.h.in files by running 'autoreconf'.
Email feedback welcome.

comment:17 Changed 9 years ago by pekkas@…

Note: I've updated the patch to be a bit more generic. No need to regenerate configure anymore.

comment:18 Changed 9 years ago by anonymous

Hi,

as the Freetz project (www.freetz.org, modded firmware for AVM routers) also faced this issue, a user contacted upstream.

A patch was posted here which is working fine.

comment:19 Changed 9 years ago by jow

  • Resolution set to fixed
  • Status changed from new to closed

Patch added in r14349 - thanks for you input!

comment:20 Changed 8 years ago by mcfly9

I still see this error on r16278 (8.09.1) and 2.4 kernel when trying to run wise or dibbler dhcpv6

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.