From faa9979fbd98fd6a75b58b5ea01f4b5c1281d08a Mon Sep 17 00:00:00 2001 From: Paul Fulghum Date: Wed, 20 Oct 2004 21:22:34 -0700 Subject: [PATCH] [PATCH] ppp: terminate connection on hangup 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 Signed-off-by: Linus Torvalds --- drivers/net/ppp_async.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 040b6566569d..d02286d6471d 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c @@ -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, -- 2.39.5