Bug 680872 - cannot add ipv6 routing rules
Summary: cannot add ipv6 routing rules
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 14
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-28 09:35 UTC by Tobias Oed
Modified: 2014-03-17 03:26 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-22 20:36:39 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
test patch (3.81 KB, patch)
2011-03-01 20:52 UTC, Bill Nottingham
no flags Details | Diff
improoved patch (3.95 KB, patch)
2011-03-11 16:51 UTC, Tobias Oed
no flags Details | Diff

Description Tobias Oed 2011-02-28 09:35:11 UTC
Description of problem:
Unlike in the ipv4 case there is no file like rule-ethX for ipv6 and this makes it impossible to add ipv6 rules using the initscripts

Here is a patch to implement this:

[root@byo0 network-scripts]# diff ifup-ipv6-original ifup-ipv6 -u
--- ifup-ipv6-original	2011-02-27 16:11:16.559838001 +0100
+++ ifup-ipv6	2011-02-27 15:59:04.589837343 +0100
@@ -167,6 +167,13 @@
 	done
 fi
 
+# Setup additional static IPv6 rules
+if [ -f "/etc/sysconfig/network-scripts/rule6-$DEVICE" ]; then
+	cat "/etc/sysconfig/network-scripts/rule6-$DEVICE" | sed 's/#.*//g' | grep -v '^[[:space:]]*$' | while read line; do
+		/sbin/ip -6 rule add $line
+	done
+fi
+
 # Setup of 6to4, if configured
 if [ "$IPV6TO4INIT" = "yes" ]; then
 	valid6to4config="yes"

Tobias Oed

Comment 1 Bill Nottingham 2011-02-28 16:27:36 UTC
ifup-post & ifup-routes still run. Does /sbin/ip not handle ipv6 rules without an explicit -6 attached?

Comment 2 Tobias Oed 2011-03-01 15:53:06 UTC
nope ip needs the -6 to do ipv6 stuff. From my experience, it never tries to guess and assumes ipv4 unless the -6 is there. For one thing, there is no way to tell if

ip rule add prio 5 fwmark 5/15 table mytable

is ipv4 or ipv6.
Further the -6  must be the first argument so one cannot cheat in rule-ethX by adding a -6 at the beginning of a line. 

I forgot the other half of my patch that removes the rules when an interface goes down. Not sure if this should be done in ifup-routes, but since that only does ipv4 rules and routes and ifup-ipv6 already handles ipv6 routes, I thought it would make sense to add the ipv6 rules there too.


[root@byo0 network-scripts]# diff ifdown-ipv6-original ifdown-ipv6 -u
--- ifdown-ipv6-original	2011-03-01 16:43:31.009064001 +0100
+++ ifdown-ipv6	2011-02-27 15:53:41.394831411 +0100
@@ -134,3 +134,13 @@
 
 # Delete all current configured IPv6 addresses on this interface
 ipv6_cleanup_device $DEVICE
+
+# Delete static IPv6 rules
+if [ -f "/etc/sysconfig/network-scripts/rule6-$DEVICE" ]; then
+	cat "/etc/sysconfig/network-scripts/rule6-$DEVICE" | sed 's/#.*//g' | grep -v '^[[:space:]]*$' | while read line; do
+		/sbin/ip -6 rule del $line
+	done
+fi
+

Tobias

Comment 3 Bill Nottingham 2011-03-01 20:52:54 UTC
Created attachment 481718 [details]
test patch

In an effort to merge ipv4 and ipv6s somewhat, I came up with the following - does it work for you?

Comment 4 Tobias Oed 2011-03-11 16:49:08 UTC
Hello,
sorry about the delay. There are a few problems, I'm attaching a slightly improoved version.
Cheers 
Tobias

Comment 5 Tobias Oed 2011-03-11 16:51:24 UTC
Created attachment 483774 [details]
improoved patch

This is the improoved patch

Comment 6 Bill Nottingham 2011-03-11 17:04:11 UTC
Added in git as http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=fc73bbccaae3858ea3f895e746467a758e6b5593. Will be in rawhide/F-15.

Comment 7 iarly selbir 2011-09-22 20:36:39 UTC
I guess this already has been fixed.


--
Fedora Bugzappers Member Team


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