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?

> +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


-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to