Bug 146377 - [ppp] [tun] Interface doesn't clear addresses when PPPoE connection closes
Summary: [ppp] [tun] Interface doesn't clear addresses when PPPoE connection closes
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 7.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-07 17:00 UTC by John Bayly
Modified: 2017-12-31 22:34 UTC (History)
0 users

See Also:


Attachments
ipcp.c.diff (829 bytes, patch)
2010-05-10 14:49 UTC, John Bayly
no flags Details | Diff
ipv6cp.c.diff (854 bytes, patch)
2010-05-10 14:49 UTC, John Bayly
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Bayly 2010-05-07 17:00:10 UTC
When using ppp to create an ADSL connection, the addresses for the tun interface aren't removed when either the connection drops (due to LCP/LQM echoes being lost), or when the connection is closed.

This means that even though a connection has been dropped, using ifconfig to check the state makes it appear as if a connection is still up.

When settings "set log +all", I've seen that the ioctl calls to remove the address (SIOCDIFADDR) is never called. Calling "iface clear" in ppp.linkdown doesn't work either, as it's executed before the connection has closed so the address cannot be removed.

I've confirmed this from looking at the ppp source: iface_Clear is only called from the following places:
1). ipcp_SetIPaddress & ipcp_SetIPv6address
2). IfaceClearCommand ie. the interactive command "iface clear"
3). bundle_destroy, which is in turn called solely from AbortProgram

Would it make sense to add a call to iface_Clear somewhere in bundle_close? Apologies for the vagueness, but I'm still getting my head around the code here.

How-To-Repeat: 1). Open ppp in interactive mode
2). ppp> dial
3). PPP> iface show
4). PPP> close
5). ppp> iface show
6). ppp> iface clear
7). ppp> iface show
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-05-07 22:39:05 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Assign to wrong mailing list.  erk.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-05-07 22:40:04 UTC
Responsible Changed
From-To: freebsd-fs->freebsd-net

Assign to right mailing list.
Comment 3 John Bayly 2010-05-10 14:49:04 UTC
Having had a good look at the source over the weekend (Spanish Grand 
Prix was dull as ever), I've seen that my suggestion of putting a call 
to iface_Clear somewhere in bundle_close was a tad off the mark. 
Noticing that the calls to iface_Add & iface_Clear appear to come from 
ipcp & ipv6cp (makes sense really) it's clear that the call to clear the 
interface's addresses should come from there too.

Also, the call to clear should be made at the last possible moment, to 
make sure that connection is definitely closed, so I add the call in the 
LayerFinish method for both ipcp & ipv6cp. I've attached diffs for both 
files.

I've tested the patched version, and by calling close in interactive 
mode, and by disconnecting the phone cable (so that the connection will 
drop after 5 LCP echoes are lost) I now have the desired effect of the 
addresses being cleared from the interface.

I'm going to run with this patched version as I can't see how this could 
cause any catastrophic issues. Would this be an acceptable solution for 
future releases?

John
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:14 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped