diff --git a/ppp-terminate-correct.patch b/ppp-terminate-correct.patch new file mode 100644 index 0000000..f79153a --- /dev/null +++ b/ppp-terminate-correct.patch @@ -0,0 +1,89 @@ +From 3eb9e810cfa515543655659b72dde30c54fea0a5 Mon Sep 17 00:00:00 2001 +From: Paul Mackerras +Date: Sun, 7 Mar 2010 15:21:38 +1100 +Subject: [PATCH 1/1] pppd: Terminate correctly if lcp_lowerup delayed calling fsm_lowerup + +Cameron Hutchison noticed that if pppd gets asked to terminate the +link in the period between when lcp_lowerup() is called and when +fsm_lowerup() is called from lcp_delayed_up() (i.e. when listen_time +is non-zero), pppd never exits. + +The reason is that lcp_close() doesn't handle the delayed-up case +properly. Since the FSM is still in STOPPED state, we don't call +lcp_finished() and therefore never exit the main event loop. + +This fixes it by handling the delayed-up case in lcp_close() as if +we had done the lowerup but the OPT_SILENT bit was set. We use the +silent case because we don't want to actually send a configure-request +at this point. + +Signed-off-by: Paul Mackerras +--- + pppd/lcp.c | 28 +++++++++++++++++++--------- + 1 files changed, 19 insertions(+), 9 deletions(-) + +diff --git a/pppd/lcp.c b/pppd/lcp.c +index 5c77490..8ed2778 100644 +--- a/pppd/lcp.c ++++ b/pppd/lcp.c +@@ -397,21 +397,29 @@ lcp_close(unit, reason) + char *reason; + { + fsm *f = &lcp_fsm[unit]; ++ int oldstate; + + if (phase != PHASE_DEAD && phase != PHASE_MASTER) + new_phase(PHASE_TERMINATE); +- if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) { ++ ++ if (f->flags & DELAYED_UP) { ++ untimeout(lcp_delayed_up, f); ++ f->state = STOPPED; ++ } ++ oldstate = f->state; ++ ++ fsm_close(f, reason); ++ if (oldstate == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT|DELAYED_UP)) { + /* + * This action is not strictly according to the FSM in RFC1548, + * but it does mean that the program terminates if you do a +- * lcp_close() in passive/silent mode when a connection hasn't +- * been established. ++ * lcp_close() when a connection hasn't been established ++ * because we are in passive/silent mode or because we have ++ * delayed the fsm_lowerup() call and it hasn't happened yet. + */ +- f->state = CLOSED; ++ f->flags &= ~DELAYED_UP; + lcp_finished(f); +- +- } else +- fsm_close(f, reason); ++ } + } + + +@@ -453,9 +461,10 @@ lcp_lowerdown(unit) + { + fsm *f = &lcp_fsm[unit]; + +- if (f->flags & DELAYED_UP) ++ if (f->flags & DELAYED_UP) { + f->flags &= ~DELAYED_UP; +- else ++ untimeout(lcp_delayed_up, f); ++ } else + fsm_lowerdown(&lcp_fsm[unit]); + } + +@@ -489,6 +498,7 @@ lcp_input(unit, p, len) + + if (f->flags & DELAYED_UP) { + f->flags &= ~DELAYED_UP; ++ untimeout(lcp_delayed_up, f); + fsm_lowerup(f); + } + fsm_input(f, p, len); +-- +1.7.1 + diff --git a/ppp.changes b/ppp.changes index 31960fb..6a1aaf8 100644 --- a/ppp.changes +++ b/ppp.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 2 14:41:21 UTC 2013 - max@suse.com + +- Add ppp-terminate-correct.patch, fix the pppd's hang after exit + (bnc#693469). + ------------------------------------------------------------------- Wed Jul 24 12:54:01 UTC 2013 - max@suse.com diff --git a/ppp.spec b/ppp.spec index 8c3bbb8..b26ae2b 100644 --- a/ppp.spec +++ b/ppp.spec @@ -71,6 +71,7 @@ Patch19: ppp-2.4.4-strncatfix.patch Patch21: ppp-2.4.4-lib64.patch Patch22: ppp-2.4.4-var_run_resolv_conf.patch Patch23: ppp-send-padt.patch +Patch24: ppp-terminate-correct.patch %description The ppp package contains the PPP (Point-to-Point Protocol) daemon, @@ -112,6 +113,7 @@ plugins for the pppd. %endif %patch22 %patch23 -p1 +%patch24 -p1 sed -i -e '1s/local\///' scripts/secure-card find scripts -type f | xargs chmod a-x