Re: [PATCH] pppoe: Use workqueue to die properly when a PADT is received

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

 



On Friday 20 February 2015 17:10:14 Christoph Schulz wrote:
> (Cc: linux-ppp@xxxxxxxxxxxxxxx, mostrows@xxxxxxxxx)
> 
> Hello!
> 
> Simon Farnsworth schrieb am Thu, 19 Feb 2015 21:24:28 +0000:
> 
> > When a PADT frame is received, the socket may not be in a good state to
> > close down the PPP interface. The current implementation handles this by
> > simply blocking all further PPP traffic, and hoping that the lack of traffic
> > will trigger the user to investigate.
> >
> > Use schedule_work to get to a process context from which we clear down the
> > PPP interface, in a fashion analogous to hangup on a TTY-based PPP
> > interface. This causes pppd to disconnect immediately, and allows tools to
> > take immediate corrective action.
> 
> Tested-by: Christoph Schulz <develop@xxxxxxxxxx>
> 
<snip success report>
> However, note also that your patch causes pppd (or rather the rp-pppoe  
> plugin) to wonder about the socket closed by the kernel:
> 
> Feb 20 16:45:44 sandbox local2.err pppd[539]: Failed to disconnect  
> PPPoE socket: 114 Operation already in progress
>
I assume there's nothing else wrong here, other than pppd complaining? The
code doesn't suggest there will be issues if we fail to disconnect.

> I don't fully understand the code there; it seems that the plugin  
> *connects* the PPPoE session socket in order to *disconnect* it:
> 
> static void
> PPPOEDisconnectDevice(void)
> {
>      struct sockaddr_pppox sp;
> 
>      sp.sa_family = AF_PPPOX;
>      sp.sa_protocol = PX_PROTO_OE;
>      sp.sa_addr.pppoe.sid = 0;
>      memcpy(sp.sa_addr.pppoe.dev, conn->ifName, IFNAMSIZ);
>      memcpy(sp.sa_addr.pppoe.remote, conn->peerEth, ETH_ALEN);
>      if (connect(conn->sessionSocket, (struct sockaddr *) &sp,
>                  sizeof(struct sockaddr_pppox)) < 0)
>          error("Failed to disconnect PPPoE socket: %d %m", errno);
>      close(conn->sessionSocket);
>      /* don't send PADT?? */
>      if (conn->discoverySocket >= 0)
>          close(conn->discoverySocket);
> }

The code is trying to disconnect the session by connecting to session 0
(which is invalid) in order to stop data flow. I'll have another look at the
kernel code tonight to see if that does anything that
close(conn->sessionSocket) won't do - I can't see a good reason for it,
though.

I suspect this is a straight bug in the rp-pppoe.so plugin.
--
Simon Farnsworth

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Audio Users]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux