Re: [PATCHv5] PPPoL2TP: Add more code snippets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-02-14 at 02:21 +0100, Samuel Thibault wrote:
[...]
> +  - Bridging L2TP sessions which have PPP pseudowire types (this is also called
> +    L2TP tunnel switching or L2TP multihop) is supported by bridging the PPP
> +    channels of the two L2TP sessions to be bridged::
> +
> +        /* Input: the session PPPoX data sockets `session_fd1` and `session_fd2`
> +         * which were created as described further above.
> +         */
> +
> +        int ppp_chan_fd;
> +        int chindx1;
> +        int chindx2;
> +        int ret;
> +
> +        ret = ioctl(session_fd1, PPPIOCGCHAN, &chindx1);
> +        if (ret < 0)
> +                return -errno;
> +
> +        ret = ioctl(session_fd2, PPPIOCGCHAN, &chindx2);
> +        if (ret < 0)
> +                return -errno;
> +
> +        ppp_chan_fd = open("/dev/ppp", O_RDWR);
> +        if (ppp_chan_fd < 0)
> +                return -errno;
> +
> +        ret = ioctl(ppp_chan_fd, PPPIOCATTCHAN, &chindx1);
> +        if (ret < 0) {
> +                close(ppp_chan_fd);
> +                return -errno;
> +        }
> +
> +        ret = ioctl(ppp_chan_fd, PPPIOCBRIDGECHAN, &chindx2);
> +        close(ppp_chan_fd);
> +        if (ret < 0)
> +                return -errno;
> +
>          return 0;
>  
> +It can be noted that when bridging PPP channels, the PPP session is not locally terminated, and no local PPP interface is created.  PPP frames arriving on one channel are directly passed to the other channel, and vice versa.

You need to format the above sentence to fit a more reasonable line
length.

Thanks!

Paolo






[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux