On 9/4/20 2:12 AM, Ken Moffat via blfs-dev wrote:
On Fri, Sep 04, 2020 at 12:44:31AM +0200, Tim Tassonis via blfs-dev wrote:
On 9/3/20 10:29 PM, Pierre Labastie via blfs-dev wrote:
On Thu, 2020-09-03 at 21:47 +0200, Tim Tassonis via blfs-dev wrote:
On 9/1/20 7:55 PM, Bruce Dubbs via blfs-dev wrote:
On 9/1/20 12:24 PM, Tim Tassonis via blfs-dev wrote:
Hi all
As one of Switzerland largest ISP's requires pppoe with vlan
tagging
for fiber connections, I wondered if vlan tagging could get
supported
in the network scripts.
As I found out via https://wiki.archlinux.org/index.php/VLAN, one
can
create a tagged VLAN using
ip link add link $REAL_IFACE name $VLAN_IFACE type vlan id
$VLAN_ID
, so I guess this could be implemented by
- checking for $VLAN_IFACE and $VLAN_ID being set
- checking for $VLAN_ID and $REAL_IFACE (in which case IFACE
then
holds the $VLAN_IFACE)
The latter would probably be more consistent with other network
stuff,
where iface always holds the resulting interface, and not the
physical
one.
I could add this to /lib/services/pppoe, if anyone else cares.
I'm not
sure if, apart from pppoe, anyone else is interested in vlan
stuff.
I'm not even sure /lib/services/pppoe is still in blfs....
If yes, I could also add this to ipv4-static and dhcpcd.
Tim, Can you send me a patch that I can review? I would want to
make
sure that changes will not affect users that do not need them.
The patch against the pppoe service file I got is as follows:
--- pppoe-service 2018-04-18 19:18:07.739547066 +0200
+++ pppoe-service-vlan 2020-09-03 21:37:27.613134901 +0200
@@ -46,11 +46,24 @@
exit 1
fi
+if [ "x${REAL_IFACE}" != "x" ] && [ "x$x${REAL_IFACE}" != "x" ]
I'm not sure what you want to do above: if the first test is true, the
second is true too, whatever the value of $x. Typo?
Correct, "x$x${REAL_IFACE}" is a typo, it should read:
if [ "x${REAL_IFACE}" != "x" ] && [ "x${REAL_IFACE}" != "x" ]
Like this, it is a very portable way to check if both of those variables
have any defined value. But there may be a bash shortcut, maybe:
Maybe I'm missing something (very possible), but you seem to be
testing the same variable twice:
if [ "x${REAL_IFACE}" != "x" ] && [ "x${REAL_IFACE}" != "x" ]
reformatted to put the two parts on separate lines:
if [ "x${REAL_IFACE}" != "x" ] &&
[ "x${REAL_IFACE}" != "x" ]
Looking at your original posting, I think one of these should maybe
be ${IFACE} ? It seems that if REAL_IFACE is set then an extra
module should be modprobed before pppoe is modprobed.
Oh my god, typical programmer's blindness. Here's the (hopefully) fixed
patch, and attached the fixed script:
--- pppoe-service 2018-04-18 19:18:07.739547066 +0200
+++ pppoe-service-vlan 2020-09-04 07:28:50.121311974 +0200
@@ -46,11 +46,24 @@
exit 1
fi
+if [ "x${REAL_IFACE}" != "x" ] && [ "x${VLAN_ID}" != "x" ]
+then
+ VLAN="Y"
+ /sbin/modprobe 8021q
+else
+ VLAN="N"
+fi
+
case "${2}" in
up)
/sbin/modprobe pppoe
log_info_msg2 "\n"
if is_true ${MANAGE_IFACE}; then
+ if [ "${VLAN}" = "Y" ]
+ then
+ /sbin/ip link set dev ${REAL_IFACE} up
+ /sbin/ip link add link ${REAL_IFACE} name ${IFACE} type vlan
id ${VLAN_ID}
+ fi
log_info_msg "Bringing up the ${IFACE} interface..."
/sbin/ip link set dev ${IFACE} up
evaluate_retval
@@ -68,6 +81,11 @@
if is_true ${MANAGE_IFACE}; then
log_info_msg "Bringing down the ${IFACE} interface..."
/sbin/ip link set dev ${IFACE} down
+ if [ "${VLAN}" = "Y" ]
+ then
+ /sbin/ip link set dev ${REAL_IFACE} down
+ /sbin/ip link del ${IFACE}
+ fi
evaluate_retval
fi
;;
#!/bin/sh
########################################################################
# Begin /lib/services/pppoe
#
# Description : pppoe Boot Script
#
# Authors : Nathan Coulson - nat...@linuxfromscratch.org
# Bruce Dubbs - bdu...@linuxfromscratch.org
# Tim Tassonis - st...@decentral.ch
#
# Version : LFS-8.2
#
########################################################################
#ONBOOT="yes"
#IFACE="enp1s0"
#SERVICE="pppoe"
#PPP_IFACE="ppp0"
#PEERNAME="dslprovider"
#MANAGE_IFACE="yes"
. /lib/lsb/init-functions
. ${IFCONFIG}
# Make compatible with older versions of init-functions
unset is_true
is_true()
{
[ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] ||
[ "$1" = "y" ] || [ "$1" = "t" ]
}
if [ -z "${IFACE}" ]; then
log_failure_msg "IFACE variable missing from ${IFCONFIG}"
exit 1
fi
if [ -z "${PPP_IFACE}" ]; then
log_failure_msg "PPP_IFACE variable missing from ${IFCONFIG}"
exit 1
fi
if [ -z "${PEERNAME}" ]; then
log_failure_msg "PEERNAME variable missing from ${IFCONFIG}"
exit 1
fi
if [ "x${REAL_IFACE}" != "x" ] && [ "x${VLAN_ID}" != "x" ]
then
VLAN="Y"
/sbin/modprobe 8021q
else
VLAN="N"
fi
case "${2}" in
up)
/sbin/modprobe pppoe
log_info_msg2 "\n"
if is_true ${MANAGE_IFACE}; then
if [ "${VLAN}" = "Y" ]
then
/sbin/ip link set dev ${REAL_IFACE} up
/sbin/ip link add link ${REAL_IFACE} name ${IFACE} type vlan id
${VLAN_ID}
fi
log_info_msg "Bringing up the ${IFACE} interface..."
/sbin/ip link set dev ${IFACE} up
evaluate_retval
sleep 2
fi
log_info_msg "Calling peer ${PEERNAME}..."
/usr/sbin/pppd call ${PEERNAME}
evaluate_retval
;;
down)
log_info_msg "Bringing down the ${PPP_IFACE}..."
killproc -p /run/${PPP_IFACE}.pid pppd
if is_true ${MANAGE_IFACE}; then
log_info_msg "Bringing down the ${IFACE} interface..."
/sbin/ip link set dev ${IFACE} down
if [ "${VLAN}" = "Y" ]
then
/sbin/ip link set dev ${REAL_IFACE} down
/sbin/ip link del ${IFACE}
fi
evaluate_retval
fi
;;
*)
echo "Usage: ${0} [interface] {up|down}"
exit 1
;;
esac
# End /lib/services/pppoe
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page