netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Farnsworth <simon@farnz.org.uk>
To: Christoph Schulz <develop@kristov.de>
Cc: netdev@vger.kernel.org, Dan Williams <dcbw@redhat.com>,
	mostrows@gmail.com, linux-ppp@vger.kernel.org
Subject: Re: [PATCH] pppoe: Use workqueue to die properly when a PADT is received
Date: Fri, 20 Feb 2015 16:41:17 +0000	[thread overview]
Message-ID: <2498181.kKNYHvd3hx@f19simon> (raw)
In-Reply-To: <20150220171014.3970204f0h4aebmu@berry.schulz.ip-v6.eu>

[-- Attachment #1: Type: text/plain, Size: 2441 bytes --]

On Friday 20 February 2015 17:10:14 Christoph Schulz wrote:
> (Cc: linux-ppp@vger.kernel.org, mostrows@gmail.com)
> 
> 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@kristov.de>
> 
<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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-02-20 16:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 21:24 [PATCH] pppoe: Use workqueue to die properly when a PADT is received Simon Farnsworth
2015-02-20 11:17 ` Simon Farnsworth
2015-02-20 13:25   ` Christoph Schulz
2015-02-20 16:10 ` Christoph Schulz
2015-02-20 16:41   ` Simon Farnsworth [this message]
2015-02-20 19:49     ` Christoph Schulz
2015-02-20 21:04       ` Simon Farnsworth
2015-02-22  2:58         ` David Miller
2015-02-20 17:05 ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2498181.kKNYHvd3hx@f19simon \
    --to=simon@farnz.org.uk \
    --cc=dcbw@redhat.com \
    --cc=develop@kristov.de \
    --cc=linux-ppp@vger.kernel.org \
    --cc=mostrows@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).