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" ]
+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
;;
I'm not sure if this corresponds to latest BLFS, but I think it's pretty
self-explanatory:
- It checks for ${REAL_IFACE} and ${VLAN_ID} early on and then sets
VLAN=Y and modprobes the vlan module in the kernel
- In up, if MANAGE_IFACE is true, and VLAN=Y, it ups the REAL_IFACE and
then adds the VLAN tagged iface
- In down, it does the corresponding cleanup, if MANAGE_IFACE is true,
and VLAN=Y
If ${REAL_IFACE} and ${VLAN_ID} are not both set, it will do nothing
special.
I attach the service file and a corresponding ifconfig.ppp0, this
currently works for me and brings the interface up cleanly.
Bye
Tim
ONBOOT="no"
IFACE="enp1s0.11"
VLAN_ID="11"
REAL_IFACE="enp1s0"
SERVICE="pppoe"
PPP_IFACE="ppp0"
PEERNAME="iway"
MANAGE_IFACE="yes"
#!/bin/sh
########################################################################
# Begin /lib/services/pppoe
#
# Description : pppoe Boot Script
#
# Authors : Nathan Coulson - [email protected]
# Bruce Dubbs - [email protected]
# Tim Tassonis - [email protected]
#
# 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