tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pppoe, dhcpcd v6 and renew
On 13/11/2017 20:27, Manuel Bouyer wrote:
On Sun, Nov 12, 2017 at 02:56:08PM +0000, Roy Marples wrote:
PPPoE needs to send the link down media event when the session terminates
and the link up media event when it gets a new one.
Then both dhcpcd and ifwatchd will see this.
Here's the patch I make for PPP for this very thing, it just needs adapting
to PPPoE I think.
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/net/if_spppsubr.c.diff?r1=1.149&r2=1.150&only_with_tag=MAIN&f=h
thanks. AFAIK this code is in netbsd-8, and pppoe0 uses if_spppsubr.c for
lcp so it should just work.
When reboot the modem, this time with pppoe0 in debug (ifconfig debug).
Here's the interesting parts of /var/log/messages:
Nov 13 21:04:56 chassiron ifwatchd[6876]: watching interface pppoe0
Nov 13 21:05:40 chassiron /netbsd: pppoe0: lcp output <echo-req id=0x13 len=8 80
-c8-99-c9>
Nov 13 21:05:50 chassiron /netbsd: pppoe0: lcp output <echo-req id=0x14 len=8 80
-c8-99-c9>
Nov 13 21:06:00 chassiron /netbsd: pppoe0: lcp output <echo-req id=0x15 len=8 80
-c8-99-c9>
Nov 13 21:06:10 chassiron /netbsd: pppoe0: LCP keepalive timed out, going to res
tart the connection
Nov 13 21:06:10 chassiron /netbsd: pppoe0: lcp close(opened)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: phase terminate
Nov 13 21:06:10 chassiron /netbsd: pppoe0: ipcp down(opened)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: ipcp close(starting)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: ipv6cp down(opened)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: ipv6cp close(starting)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: lcp output <term-req id=0x16 len=4>
Nov 13 21:06:10 chassiron dhcpcd[1215]: pppoe0: carrier lost
dhcpcd saw that pppoe0 went down, good
Nov 13 21:06:10 chassiron /netbsd: pppoe0: disconnecting
Nov 13 21:06:10 chassiron /netbsd: pppoe0: lcp down(stopped)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: phase establish
Nov 13 21:06:10 chassiron /netbsd: pppoe0: Down event (carrier loss), taking interface down.
Nov 13 21:06:10 chassiron /netbsd: pppoe0: lcp close(starting)
Nov 13 21:06:10 chassiron /netbsd: pppoe0: phase dead
Nov 13 21:06:12 chassiron ntpd[21224]: Deleting interface #13 pppoe0, fe80::43e:
1a93:9ba2:3ac9%6#123, interface stats: received=0, sent=0, dropped=0, active_tim
e=117021 secs
Nov 13 21:06:12 chassiron ntpd[21224]: Deleting interface #14 pppoe0, 151.127.5.
145#123, interface stats: received=1071, sent=1073, dropped=0, active_time=117021 secs
Nov 13 21:06:12 chassiron ntpd[21224]: 132.227.73.242 local addr 151.127.5.145 -> <null>
Nov 13 21:06:12 chassiron ntpd[21224]: 134.157.254.19 local addr 151.127.5.145 -> <null>
Nov 13 21:06:12 chassiron ntpd[21224]: 213.251.128.249 local addr 151.127.5.145 -> <null>
Nov 13 21:06:12 chassiron ntpd[21224]: Deleting interface #15 pppoe0, 2001:41d0:fe9d:1101::1#123, interface stats: received=0, sent=0, dropped=0, active_time=117021 secs
Nov 13 21:07:15 chassiron /netbsd: pppoe0: connected to lns-1-par-se100
Nov 13 21:07:15 chassiron /netbsd: pppoe0: connected to lns-1-par-se100
Nov 13 21:07:16 chassiron /netbsd: pppoe0: session 0x2303 connected
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp open(initial)
Nov 13 21:07:16 chassiron /netbsd: pppoe0: phase establish
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp up(starting)
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp output <conf-req id=0x17 len=14 05-06-80-c8-99-c9-01-04-05-d4>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp input(req-sent): <conf-req id=0x8b len=19 01-04-05-d4-03-05-c2-23-05-05-06-0e-44-4a-7e>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp parse opts: mru auth-proto magic
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp parse opt values: mru 1492 auth-proto magic 0xe444a7e send conf-ack
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp output <conf-ack id=0x8b len=19 01-04-05-d4-03-05-c2-23-05-05-06-0e-44-4a-7e>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp input(ack-sent): <conf-ack id=0x17 len=14 05-06-80-c8-99-c9-01-04-05-d4>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: lcp tlu
Nov 13 21:07:16 chassiron /netbsd: pppoe0: phase authenticate
Nov 13 21:07:16 chassiron /netbsd: pppoe0: chap input <challenge id=0x1 len=37 name=lns-1-par-se1200 value-size=16 value= xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: chap output <response id=0x1 len=42 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: chap success: CHAP authentication success, unit 7887
Nov 13 21:07:16 chassiron /netbsd: pppoe0: phase network
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp open(initial)
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp open(initial)
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp up(starting)
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp output <conf-req id=0x5 len=4>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp up(starting)
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp output <conf-req id=0x5 len=14 01-0a-04-3e-1a-93-9b-a2-3a-c9>
Nov 13 21:07:16 chassiron dhcpcd[1215]: pppoe0: carrier acquired
dhcpcd sees that the carrier is back, good
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp input(req-sent): <conf-req id=0xb7 len=10 03-06-b2-20-25-03>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp parse opts: address
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp parse opt values: address 0.0.0.1 [ack] send conf-ack
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp output <conf-ack id=0xb7 len=10 03-06-b2-20-25-03>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp input(ack-sent): <conf-ack id=0x5 len=4>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipcp tlu
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp input(req-sent): <conf-req id=0x67 len=14 01-0a-02-30-88-ff-fe-04-63-c9>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp parse opts: ifid
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp parse opt values: ifid fe80:6::230:88ff:fe04:63c9 [conf-ack] send conf-ack
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp output <conf-ack id=0x67 len=14 01-0a-02-30-88-ff-fe-04-63-c9>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp input(ack-sent): <conf-ack id=0x5 len=14 01-0a-04-3e-1a-93-9b-a2-3a-c9>
Nov 13 21:07:16 chassiron /netbsd: pppoe0: ipv6cp tlu
Nov 13 21:07:16 chassiron dhcpcd[1215]: pppoe0: IAID 00:00:00:06
Nov 13 21:07:16 chassiron dhcpcd[1215]: pppoe0: IAID 00:00:00:06
dhcpcd did try and start the interface, but didn't actually do anything.
Can you try the attached patch please?
I've only compile tested it and won't be able to actually try it for a
while.
Roy
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 2910274a..ef71dd71 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -3673,27 +3673,31 @@ dhcp6_start(struct interface *ifp, enum DH6S init_state)
struct dhcp6_state *state;
state = D6_STATE(ifp);
- if (state) {
- if (state->state == DH6S_INFORMED &&
- init_state == DH6S_INFORM)
- {
- dhcp6_startinform(ifp);
- return 0;
- }
- if (init_state == DH6S_INIT &&
- ifp->options->options & DHCPCD_DHCP6 &&
- (state->state == DH6S_INFORM ||
- state->state == DH6S_INFORMED ||
- state->state == DH6S_DELEGATED))
- {
- /* Change from stateless to stateful */
+ if (state != NULL) {
+ switch (init_state) {
+ case DH6S_INIT:
+ /* This should only happen on OS's where we keep state
+ * on carrier down, such as NetBSD-8. */
goto gogogo;
+ case DH6S_INFORM:
+ if (state->state == DH6S_INFORMED)
+ dhcp6_startinform(ifp);
+ break;
+ case DH6S_REQUEST:
+ if (ifp->options->options & DHCPCD_DHCP6 &&
+ (state->state == DH6S_INFORM ||
+ state->state == DH6S_INFORMED ||
+ state->state == DH6S_DELEGATED))
+ {
+ /* Change from stateless to stateful */
+ init_state = DH6S_INIT;
+ goto gogogo;
+ }
+ break;
+ default:
+ /* Not possible, but sushes some compiler warnings. */
+ break;
}
- /* We're already running DHCP6 */
- /* XXX: What if the managed flag vanishes from all RA? */
-#ifndef SMALL
- dhcp6_activateinterfaces(ifp);
-#endif
return 0;
}
diff --git a/src/ipv6nd.c b/src/ipv6nd.c
index a35381f7..8217edf6 100644
--- a/src/ipv6nd.c
+++ b/src/ipv6nd.c
@@ -1088,7 +1088,7 @@ handle_flag:
#define LOG_DHCP6 logdebug
#endif
if (rap->flags & ND_RA_FLAG_MANAGED) {
- if (new_data && dhcp6_start(ifp, DH6S_INIT) == -1)
+ if (new_data && dhcp6_start(ifp, DH6S_REQUEST) == -1)
LOG_DHCP6("dhcp6_start: %s", ifp->name);
} else if (rap->flags & ND_RA_FLAG_OTHER) {
if (new_data && dhcp6_start(ifp, DH6S_INFORM) == -1)
Home |
Main Index |
Thread Index |
Old Index