Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#31380 - [ppp] [netcfg] ipv6 over pppoe support patch
Attached to Project:
Arch Linux
Opened by Gala Dragos (arch_gala) - Saturday, 01 September 2012, 18:06 GMT
Last edited by Evangelos Foutras (foutrelis) - Wednesday, 05 December 2012, 19:07 GMT
Opened by Gala Dragos (arch_gala) - Saturday, 01 September 2012, 18:06 GMT
Last edited by Evangelos Foutras (foutrelis) - Wednesday, 05 December 2012, 19:07 GMT
|
DetailsDescription:
A patch for netcfg to support ipv6 over pppoe connections Additional info: * package version(s) 2.8.9 Attached is modified pppoe script to allow ipv6 to be enabled over pppoe connections. It requires pppd over 2.4.3, current shipped version in Arch is 2.4.5 so there should be no problem. In order to use the patch you define "PPPOE_IPV6=yes" in the connection connection configuration file. The modified pppoe script will detect this and write the correct thing in pppd options file. This should have a high priority, because we have entered the IPV6 era, aren't we ? |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Wednesday, 05 December 2012, 19:07 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented in ppp 2.4.5-5.
Wednesday, 05 December 2012, 19:07 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented in ppp 2.4.5-5.
To use IPv6 over pppoe the system must be configured properly, therefore we must do the following:
- automatic router advertisements must be accepted (for ipv6) at least on the new ppp interface;
- temporary address usage must NOT be enabled, at least on the new ppp interface.
The script currently does not cover the above configurations, if somebody can figure out how to get the created ppp interface name I can whip something up to automatically set the correct flags in /proc.
Also the script fixed a problem with the original one:
- the pppd options file is created at "/run/network/pppoe.eth0.connection_file_name", which is wrong as not all connections are done over eth0;
I have fixed the above by allowing the script to specify the actual interface name over which the ppp is initiated, instead of eth0.
Now it handles the flags needed in /proc for the ppp interface to be able to get an ipv6 address with no intervention from the user, aside from specifically enabling ipv6 over pppoe.
Tests done on my isp have completed successfully. I would really like to see this in the next release of netcfg package.
I haven't found any other network manager (in Arch or other distro) to support ipv6 over pppoe.
- in english: https://bbs.archlinux.org/viewtopic.php?id=148192
- in romanian: http://bbs.archlinux.ro/viewtopic.php?pid=3428#p3428
> @@ -1,6 +1,8 @@
> #! /bin/bash
> . /usr/lib/network/network
>
> +# ipv6 extensions added by GALALAE Dragos Ionut
> +
Thomas Bächler is the main author. Might as well list him too. Additionally an e-mail address would be nice if you really want to list yourself.
> _quotestring() {
> echo "\"${1/\"/\\\"}\""
> }
> @@ -9,9 +11,9 @@ pppoe_up() {
> local cfg
> load_profile "$1"
>
> - mkdir -p "$STATE_DIR"/pppoe.eth0."$1"/
> - chmod 700 "$STATE_DIR"/pppoe.eth0."$1"/
> - cfg="$STATE_DIR"/pppoe.eth0."$1"/options
> + mkdir -p "$STATE_DIR"/pppoe."${INTERFACE}"."$1"/
> + chmod 700 "$STATE_DIR"/pppoe."${INTERFACE}"."$1"/
> + cfg="$STATE_DIR"/pppoe."${INTERFACE}"."$1"/options
Looks sane, perhaps Thomas can clarify why it wasn't like this in the first place.
> : > "${cfg}"
> chmod 600 "${cfg}"
>
> @@ -43,22 +45,43 @@ pppoe_up() {
> [[ -n ${PPPOE_AC} ]] && echo "rp_pppoe_ac $(_quotestring "${PPPOE_AC}")" >> "${cfg}"
> [[ -n ${PPPOE_SESSION} ]] && echo "rp_pppoe_sess $(_quotestring "${PPPOE_SESSION}")" >> "${cfg}"
> [[ -n ${PPPOE_MAC} ]] && echo "pppoe-mac $(_quotestring "${PPPOE_MAC}")" >> "${cfg}"
> +
> + if [[ ${PPPOE_IPV6} == yes ]]; then
> + echo "+ipv6" >> "${cfg}"
> + fi
What is wrong with just
[[ ${PPPOE_IPV6} == yes ]] && echo "+ipv6" >> "${cfg}"
like all the lines above?
Additionally, I think PPPOE_IP6 would be a slightly better name, or even just IP6 (cf. ethernet).
>
> /sbin/ip link set dev ${INTERFACE} up
> - /usr/sbin/pppd file "${cfg}"
> +
> + # get bad status from a piped program
> + set -o pipefail
> + # execute pppd with required parameters, and get the name of the newly created ppp interface
> + local pppiface
> + pppiface=$( /usr/sbin/pppd file "${cfg}" | grep 'ppp[0-9]\+$' | sed 's/.*\(ppp[0-9]\+\)/\1/')
Rather something like:
pppiface=$(/usr/sbin/pppd file "${cfg}" | grep -o 'ppp[[:digit:]]\+$')
>
> + # status ok ?
Unnecessary comment.
> if [[ $? -ne 0 ]]; then
> rm "${cfg}"
> - rmdir "$STATE_DIR"/pppoe.eth0."$1"/
> + rmdir "$STATE_DIR"/pppoe."${INTERFACE}"."$1"/
> report_fail "Couldn't make pppd connection."
> return 1
> fi
> +
> + # ipv6 over ppp need special care, because they probably assumed that ppp will never be used with ipv6
> + if [[ ${PPPOE_IPV6} == yes ]]; then
Don't forget to rename the variable here too.
> + # must disable the privacy extensions on the connection,
> + # because it would otherwise use those and they are not routed by the isp
> + echo "0" > /proc/sys/net/ipv6/conf/${pppiface}/use_tempaddr
> + # if forwarding is enabled, then we must force the interface to receive an ip,
> + # see the specs why we need this
> + echo "2" > /proc/sys/net/ipv6/conf/${pppiface}/accept_ra
> + fi
> +
> }
>
> pppoe_down() {
> load_profile "$1"
> local cfg
> - cfg="$STATE_DIR"/pppoe.eth0."$1"/options
> + cfg="$STATE_DIR"/pppoe."${INTERFACE}"."$1"/options
> PIDFILE="/var/run/ppp-$1.pid"
>
> if [[ -e $PIDFILE ]]; then
> @@ -67,7 +90,7 @@ pppoe_down() {
> fi
>
> rm "${cfg}"
> - rmdir "$STATE_DIR"/pppoe.eth0."$1"/
> + rmdir "$STATE_DIR"/pppoe."${INTERFACE}"."$1"/
> }
>
> pppoe_$1 "$2"
I have added Thomas, because he is the original author. If he thinks it is fine, I will push it.
Heck you can even delete it as it was meant for the developers, if they are kind enough to add me to the contributors list.
The main thing is, does the script works for you ?
Second, the patch contains lots of trailing whitespaces and indentation errors.
I don't like the method which is used to determine the name of the ppp interface. The safest way is to explicitly determine it via the 'unit' option, and make sure that the interface is unused beforehand - for example: for i=0..9, test if /sys/class/net/ppp$i exists, and if not, add the 'unit $i' option. Unfortunately, this can also get racy if two ppp processes are started at the same time.
Another solution would be to add /etc/ppp/ip6-up to the ppp package to handle this - this is probably the best solution.
which is why I opted to extract the ppp interface name from pppd's output
Also this cleans up the boot log, as it removes the unnecessary output from pppd, which appears when connection starts.
>> indentation errors
I use tab for indentations, and gedit as an editor
>> The eth0 stuff was an oversight, apparently nobody noticed.
I've only noticed it because I had my pppoe connections over nic0.
The indentation is inconsistent all around the changed file.
> > this can also get racy if two ppp processes are started at the same time
> which is why I opted to extract the ppp interface name from pppd's output
It's ugly to do it this way. I think adding this to a default ip6-up script for ppp makes much more sense - these settings apply to all ipv6 ppp connections, not just netcfg.
> Also this cleans up the boot log, as it removes the unnecessary output from pppd, which appears when connection starts.
This can be changed in the rc.d script for initscripts. I'd like to keep the output, as you can find it in systemd's journal after boot.
I agree on an ip6-up script, it really does make sense, especially it you consider some mobile operators are starting to role out ip6 on their network.
By using the unit option on pppd you are taking away the automatic and consistent interface naming, which pppd handles so well. Isn't there an option to instruct pppd to pass the new interface name to the script?
Alternatively you can take snapshots of configured ppp interface names before you run pppd and compare them with ppp interface names after pppd has started successfully. Initially I've parsed "ip link show" to achieve this, but I thought it was too complicated, so I've modified it to parse pppd's own output, which always contains the ppp interface name that is created now.
@Thomas: can I hand this report off to you?
https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/ppp&id=2cb30452eb7f3e800f76ab3e12caeb0b2e568019