]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppp: terminate connection on hangup
authorPaul Fulghum <paulkf@microgate.com>
Thu, 21 Oct 2004 04:22:34 +0000 (21:22 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Thu, 21 Oct 2004 04:22:34 +0000 (21:22 -0700)
I reviewed, patched, and tested ppp_async.c to implement
ldisc->hangup().  This correctly terminates the PPP connection on
hangup.

Paul Mackerras already did an excellent job of ensuring safe shutdown
and I/O completion in ldisc->close so the change is trivial: just add
the ldisc->hangup and call the existing close routine.

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/net/ppp_async.c

index 040b6566569d68b352fd837d19f2f6b10c1fa021..d02286d6471d25a3ac01800e3c26560fd162a800 100644 (file)
@@ -237,6 +237,18 @@ ppp_asynctty_close(struct tty_struct *tty)
        kfree(ap);
 }
 
+/*
+ * Called on tty hangup in process context.
+ *
+ * Wait for I/O to driver to complete and unregister PPP channel.
+ * This is already done by the close routine, so just call that.
+ */
+static int ppp_asynctty_hangup(struct tty_struct *tty)
+{
+       ppp_asynctty_close(tty);
+       return 0;
+}
+
 /*
  * Read does nothing - no data is ever available this way.
  * Pppd reads and writes packets via /dev/ppp instead.
@@ -380,6 +392,7 @@ static struct tty_ldisc ppp_ldisc = {
        .name   = "ppp",
        .open   = ppp_asynctty_open,
        .close  = ppp_asynctty_close,
+       .hangup = ppp_asynctty_hangup,
        .read   = ppp_asynctty_read,
        .write  = ppp_asynctty_write,
        .ioctl  = ppp_asynctty_ioctl,