I observed several termination and re-authentification requests of my
pppoe link within hours since the upgrade to version 5.9
Monitoring the pppoe interface and dumping the lcp control packages
showed that the openbsd 5.9 client always initiates a termination
request without previous sending a lcp-echo request.
I observed lcp-echo request from the isp-side which were all properly
answered by a lcp-echo reply of the 5.9 client but not one lcp-echo
request from the client side.
A look at the code of "/usr/src/sys/net/if_spppsubr.c" showed a problem
with the last "else clause" at the end of the "sppp_keepalive" subroutine:
/*
* Send keepalive packets, every 10 seconds.
*/
void
sppp_keepalive(void *dummy)
{
struct sppp *sp;
int s;
struct timeval tv;
s = splnet();
getmicrouptime(&tv);
for (sp=spppq; sp; sp=sp->pp_next) {
struct ifnet *ifp = &sp->pp_if;
/* Keepalive mode disabled or channel down? */
if (! (sp->pp_flags & PP_KEEPALIVE) ||
! (ifp->if_flags & IFF_RUNNING))
continue;
/* No keepalive if LCP not opened yet. */
if (sp->pp_phase < PHASE_AUTHENTICATE)
continue;
/* No echo reply, but maybe user data passed through? */
if ((tv.tv_sec - sp->pp_last_receive) < NORECV_TIME) {
sp->pp_alivecnt = 0;
continue;
}
if (sp->pp_alivecnt >= MAXALIVECNT) {
/* No keepalive packets got. Stop the
interface. */
if_down (ifp);
mq_purge(&sp->pp_cpq);
log(LOG_INFO, SPP_FMT "LCP keepalive timeout\n",
SPP_ARGS(ifp));
sp->pp_alivecnt = 0;
/* we are down, close all open protocols */
lcp.Close(sp);
/* And now prepare LCP to reestablish the link,
* if configured to do so. */
sppp_cp_change_state(&lcp, sp, STATE_STOPPED);
/* Close connection immediately, completion of this
* will summon the magic needed to reestablish
it. */
if (sp->pp_tlf)
sp->pp_tlf(sp);
continue;
}
if (sp->pp_alivecnt < MAXALIVECNT)
++sp->pp_alivecnt;
else if (sp->pp_phase >= PHASE_AUTHENTICATE) {
u_int32_t nmagic = htonl(sp->lcp.magic);
sp->lcp.echoid = ++sp->pp_seq;
sppp_cp_send (sp, PPP_LCP, ECHO_REQ,
sp->lcp.echoid, 4, &nmagic);
}
}
splx(s);
timeout_add_sec(&keepalive_ch, 10);
}
The above else clause "else if (sp->pp_phase >= PHASE_AUTHENTICATE) {"
will never be reached!
I changed the last if else block to:
++sp->pp_alivecnt;
if (sp->pp_phase >= PHASE_AUTHENTICATE) {
u_int32_t nmagic = htonl(sp->lcp.magic);
sp->lcp.echoid = ++sp->pp_seq;
sppp_cp_send (sp, PPP_LCP, ECHO_REQ,
sp->lcp.echoid, 4, &nmagic);
}
After building a new kernel it showed up that during times of low
traffic the client now sends lcp-echo requests which keep the line up.
This did solve the problem for me!
Here is a diff betwen the original and the new if_spppsubr.c:
--- if_spppsubr.c Tue Apr 5 13:30:29 2016
+++ if_spppsubr.c.orig Mon Nov 23 15:41:05 2015
@@ -4092,10 +4092,9 @@
sp->pp_tlf(sp);
continue;
}
-
- ++sp->pp_alivecnt;
-
- if (sp->pp_phase >= PHASE_AUTHENTICATE) {
+ if (sp->pp_alivecnt < MAXALIVECNT)
+ ++sp->pp_alivecnt;
+ else if (sp->pp_phase >= PHASE_AUTHENTICATE) {
u_int32_t nmagic = htonl(sp->lcp.magic);
sp->lcp.echoid = ++sp->pp_seq;
sppp_cp_send (sp, PPP_LCP, ECHO_REQ,
The dmesg of my pppoe-router (an old thinkpad notebook) looks like this:
OpenBSD 5.9 (GENERIC) #1561: Fri Feb 26 01:22:37 MST 2016
[email protected]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) III Mobile CPU 1000MHz ("GenuineIntel"
686-class) 1 GHz
cpu0:
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,SSE,PERF
real mem = 133054464 (126MB)
avail mem = 118013952 (112MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 11/14/01, BIOS32 rev. 0 @ 0xfd7e0, SMBIOS rev.
2.31 @ 0x7f7c000 (48 entries)
bios0: vendor IBM version "1EET48WW (1.03c)" date 11/14/2001
bios0: IBM 26523WG
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT BOOT
acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) PCI0(S4) PCI1(S4)
DOCK(S4) USB0(S3) USB1(S3) USB2(S3) AC97(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCI1)
acpiec at acpi0 not configured
acpicpu0 at acpi0: !C3(@120 io@0x101d), !C2(@84 io@0x101c), C1(@1
halt!), FVS, 1000, 733 MHz
acpipwrres0 at acpi0: PUBS, resource for USB0, USB1
acpitz0 at acpi0: critical temperature is 97 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "IBM-02K6794" serial 452 type LION oem
"SANYO"
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad at acpi0 not configured
acpidock0 at acpi0: DOCK not docked (0)
bios0: ROM list: 0xc0000/0x10000 0xd0000/0x1000 0xd1000/0x1000
0xdc000/0x4000! 0xe0000/0x10000
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82830M Host" rev 0x02
intelagp0 at pchb0
agp0 at intelagp0: aperture at 0xd0000000, size 0xe400000
ppb0 at pci0 dev 1 function 0 "Intel 82830M AGP" rev 0x02
pci1 at ppb0 bus 1
radeondrm0 at pci1 dev 0 function 0 "ATI Radeon Mobility M6" rev 0x00
drm0 at radeondrm0
radeondrm0: irq 11
uhci0 at pci0 dev 29 function 0 "Intel 82801CA/CAM USB" rev 0x01: irq 11
uhci1 at pci0 dev 29 function 1 "Intel 82801CA/CAM USB" rev 0x01: irq 11
uhci2 at pci0 dev 29 function 2 "Intel 82801CA/CAM USB" rev 0x01: irq 11
ppb1 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0x41
pci2 at ppb1 bus 2
2:0:0: mem address conflict 0x50000000/0x1000
2:0:1: mem address conflict 0x50100000/0x1000
cbb0 at pci2 dev 0 function 0 "Ricoh 5C476 CardBus" rev 0x80: irq 11
cbb1 at pci2 dev 0 function 1 "Ricoh 5C476 CardBus" rev 0x80: irq 11
fxp0 at pci2 dev 8 function 0 "Intel PRO/100 VE" rev 0x41, i82562: irq
11, address 00:d0:59:b5:09:e4
inphy0 at fxp0 phy 1: i82562ET 10/100 PHY, rev. 0
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 3 device 0 cacheline 0x0, lattimer 0xb0
pcmcia0 at cardslot0
cardslot1 at cbb1 slot 1 flags 0
cardbus1 at cardslot1: bus 6 device 0 cacheline 0x0, lattimer 0xb0
pcmcia1 at cardslot1
ichpcib0 at pci0 dev 31 function 0 "Intel 82801CAM LPC" rev 0x01
pciide0 at pci0 dev 31 function 1 "Intel 82801CAM IDE" rev 0x01: DMA,
channel 0 configured to compatibility, channel 1 configured to compatibility
wd0 at pciide0 channel 0 drive 0: <SAMSUNG HM160HC>
wd0: 16-sector PIO, LBA48, 152627MB, 312581808 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <HL-DT-ST, DVD-ROM GDR8081N, 0011> ATAPI
5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
ichiic0 at pci0 dev 31 function 3 "Intel 82801CA/CAM SMBus" rev 0x01: irq 11
iic0 at ichiic0
auich0 at pci0 dev 31 function 5 "Intel 82801CA/CAM AC97" rev 0x01: irq
11, ICH3 AC97
ac97: codec id 0x43525936 (Cirrus Logic CS4299 rev 6)
ac97: codec features headphone, 20 bit DAC, 18 bit ADC, Crystal Semi 3D
audio0 at auich0
"Intel 82801CA/CAM Modem" rev 0x01 at pci0 dev 31 function 6 not configured
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb1 at uhci1: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci2: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at ichpcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt2 at isa0 port 0x3bc/4: polled
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
rl0 at cardbus1 dev 0 function 0 "Realtek 8139" rev 0x10: irq 11,
address 00:1f:1f:73:55:11
rlphy0 at rl0 phy 0: RTL internal PHY
root on wd0a (4002dfbb29434b21.a) swap on wd0b dump on wd0b
error: [drm:pid0:r100_ring_test] *ERROR* radeon: ring test failed
(scratch(0x15E4)=0xCAFEDEAD)
error: [drm:pid0:r100_cp_init] *ERROR* radeon: cp isn't working (-22).
drm:pid0:r100_startup *ERROR* failed initializing CP (-22).
drm:pid0:r100_init *ERROR* Disabling GPU acceleration
error: [drm:pid0:r100_cp_fini] *ERROR* Wait for CP idle timeout,
shutting down CP.
Failed to wait GUI idle while programming pipes. Bad things might happen.
ttm_pool_mm_shrink_fini stub
radeondrm0: 1400x1050
wsdisplay0 at radeondrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)