On Tuesday, January 31, 2012 10:02 CET, "Sebastian Reitenbach" 
<[email protected]> wrote: 
 
> On Monday, January 30, 2012 15:43 CET, YASUOKA Masahiko <[email protected]> 
> wrote: 
>  
> > On Mon, 30 Jan 2012 22:49:22 +0900 (JST)
> > YASUOKA Masahiko <[email protected]> wrote:
> > > pipex hook in udp_usrreq() mistakenly assumed that `inp' is
> > > connected.  The hook could not use the destination address properly,
> > > so it failed to find the pipex session.  This bug caused LCP keepalive
> > > failures on L2TP from client that does LCP keepalive and uses sequence
> > > number on the L2TP data channel (xl2tpd + pppd).
> > > 
> > > The diff includes kernel header file changes.
> > > 
> > > ok?
> > 
> > Oops.  Let me update the diff.
> > 
> > The given struct sockaddr object of
> > pipex_l2tp_userland_lookup_session() became passed from the userland,
> > so its address family must be checked.
> > 
> > ok?
> 
> tested IPSec/L2TP with xl2tpd, strongswan client. I did setup the tunnel 
> yesterday 
> evening, and its still alive this morning. Without the patch, the tunnel 
> usually died after
> a couple of minutes.
> 
> So this definitely works for me, but I'm probably not the right guy to OK 
> that in this phase of 
> release cycle.
> 
> I'll now try with Android phone, since I've seen the same problems with dying 
> tunnel too.

The tunnel established with Android 2.2, now also seems to be stable, at least 
for the last two hours and 15 minutes.
Prior to the patch, like with the Linux client, the tunnel died within a couple 
of minutes, maybe half an hour or hour.

However, I noted with tcpdump, listening on tun0:


# tcpdump -n -i tun0
tcpdump: listening on tun0, link-type LOOP
13:51:15.354776 
tcpdump: WARNING: compensating for unaligned libpcap packets
13:51:15.354795 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:16.334984 
13:51:16.334997 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:17.355463 
13:51:17.355474 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:18.375712 
13:51:18.375722 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:19.354994 
13:51:19.355004 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:20.375274 
13:51:20.375285 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:21.355354 
13:51:21.355364 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:22.334948 
13:51:22.334959 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:23.394820 
13:51:23.394831 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:24.374594 
13:51:24.374605 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:25.394998 
13:51:25.395009 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:26.394767 
13:51:26.394777 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:27.415028 
13:51:27.415039 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
13:51:28.375882 
13:51:28.375892 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)

Also when I show the contents with -X:


# tcpdump -n -i tun0 -s 2000 -X
tcpdump: listening on tun0, link-type LOOP
13:55:32.395223 
  0000: 4500 0054 0000 4000 4001 a1a3 0a42 4281  E..T..@[email protected].
  0010: 0a42 4201 0800 6b54 6063 08bc 43e5 274f  .BB...kT`c..C.'O
  0020: c554 0800 0809 0a0b 0c0d 0e0f 1011 1213  .T..............
  0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223  ............ !"#
  0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233  $%&'()*+,-./0123
  0050: 3435 3637                                4567

tcpdump: WARNING: compensating for unaligned libpcap packets
13:55:32.395249 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
  0000: 8266 4000 ff01 603c 0a42 4201 0a42 4281  .f@...`<.BB..BB.
  0010: 0000 7354 6063 08bc 43e5 274f c554 0800  ..sT`c..C.'O.T..
  0020: 0809 0a0b 0c0d 0e0f 1011 1213 1415 1617  ................
  0030: 1819 1a1b 1c1d 1e1f 2021 2223 2425 2627  ........ !"#$%&'
  0040: 2829 2a2b 2c2d 2e2f 3031 3233 3435 3637  ()*+,-./01234567
  0050: 0000 0000                                ....

13:55:34.315241 
  0000: 4500 0054 0000 4000 4001 a1a3 0a42 4281  E..T..@[email protected].
  0010: 0a42 4201 0800 5e54 6063 08bd 44e5 274f  .BB...^T`c..D.'O
  0020: d153 0800 0809 0a0b 0c0d 0e0f 1011 1213  .S..............
  0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223  ............ !"#
  0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233  $%&'()*+,-./0123
  0050: 3435 3637                                4567

13:55:34.315253 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
  0000: cd82 4000 ff01 1520 0a42 4201 0a42 4281  ..@.... .BB..BB.
  0010: 0000 6654 6063 08bd 44e5 274f d153 0800  ..fT`c..D.'O.S..
  0020: 0809 0a0b 0c0d 0e0f 1011 1213 1415 1617  ................
  0030: 1819 1a1b 1c1d 1e1f 2021 2223 2425 2627  ........ !"#$%&'
  0040: 2829 2a2b 2c2d 2e2f 3031 3233 3435 3637  ()*+,-./01234567
  0050: 0000 0000                                ....

13:55:34.994293 
  0000: 4500 0054 0000 4000 4001 a1a3 0a42 4281  E..T..@[email protected].
  0010: 0a42 4201 0800 8752 6063 08be 45e5 274f  .BB....R`c..E.'O
  0020: a754 0800 0809 0a0b 0c0d 0e0f 1011 1213  .T..............
  0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223  ............ !"#
  0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233  $%&'()*+,-./0123
  0050: 3435 3637                                4567

13:55:34.994304 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
  0000: 8732 4000 ff01 5b70 0a42 4201 0a42 4281  .2@...[p.BB..BB.
  0010: 0000 8f52 6063 08be 45e5 274f a754 0800  ...R`c..E.'O.T..
  0020: 0809 0a0b 0c0d 0e0f 1011 1213 1415 1617  ................
  0030: 1819 1a1b 1c1d 1e1f 2021 2223 2425 2627  ........ !"#$%&'
  0040: 2829 2a2b 2c2d 2e2f 3031 3233 3435 3637  ()*+,-./01234567
  0050: 0000 0000                                ....

13:55:37.674594 
  0000: 4500 0054 0000 4000 4001 a1a3 0a42 4281  E..T..@[email protected].
  0010: 0a42 4201 0800 8651 6063 08bf 46e5 274f  .BB....Q`c..F.'O
  0020: a754 0800 0809 0a0b 0c0d 0e0f 1011 1213  .T..............
  0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223  ............ !"#
  0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233  $%&'()*+,-./0123
  0050: 3435 3637                                4567

13:55:37.674606 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
  0000: 9a59 4000 ff01 4849 0a42 4201 0a42 4281  [email protected].
  0010: 0000 8e51 6063 08bf 46e5 274f a754 0800  ...Q`c..F.'O.T..
  0020: 0809 0a0b 0c0d 0e0f 1011 1213 1415 1617  ................
  0030: 1819 1a1b 1c1d 1e1f 2021 2223 2425 2627  ........ !"#$%&'
  0040: 2829 2a2b 2c2d 2e2f 3031 3233 3435 3637  ()*+,-./01234567
  0050: 0000 0000                                ....

13:55:39.014143 
  0000: 4500 0054 0000 4000 4001 a1a3 0a42 4281  E..T..@[email protected].
  0010: 0a42 4201 0800 6698 6063 08c0 48e5 274f  .BB...f.`c..H.'O
  0020: c50c 0800 0809 0a0b 0c0d 0e0f 1011 1213  ................
  0030: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223  ............ !"#
  0040: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233  $%&'()*+,-./0123
  0050: 3435 3637 

The incoming packets look weird, and this is not only true for icmp, with 
tcp/udp its the same.
Listening with tcpdump on enc0, all looks normal.

I only installed the new kernel, did not recompiled/reinstalled tcpdump.

Sebastian


OpenBSD 5.0-current (GENERIC) #1: Mon Jan 30 16:53:57 CET 2012
    [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
RTC BIOS diagnostic error 80<clock_battery>
real mem = 2118586368 (2020MB)
avail mem = 2048135168 (1953MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe2cc0 (34 entries)
bios0: vendor Intel Corp. version "CO96510J.86A.6079.2008.0727.2220" date 
07/27/2008
bios0: Intel Corporation DQ965CO
acpi0 at bios0: rev 0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC WDDT MCFG ASF! SSDT SSDT SSDT SSDT SSDT TCPA
acpi0: wakeup devices SLPB(S4) P32_(S4) UAR1(S4) UAR2(S4) ILAN(S4) PEGP(S4) 
PEX0(S4) PEX1(S4) PEX2(S4) PEX3(S4) PEX4(S4) PEX5(S4) UHC1(S3) UHC2(S3) 
UHC3(S3) UHC4(S3) EHCI(S3) EHC2(S3) UH42(S3) UHC5(S3) AZAL(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz, 1866.97 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,SSE3,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF
cpu0: 2MB 64b/line 8-way L2 cache
cpu0: apic clock running at 266MHz
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 2
acpimcfg0 at acpi0 addr 0xf0000000, bus 0-127
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 6 (P32_)
acpiprt2 at acpi0: bus 1 (PEX0)
acpiprt3 at acpi0: bus 2 (PEX1)
acpiprt4 at acpi0: bus 3 (PEX2)
acpiprt5 at acpi0: bus 4 (PEX3)
acpiprt6 at acpi0: bus 5 (PEX4)
acpiprt7 at acpi0: bus -1 (PEX5)
acpicpu0 at acpi0: PSS
acpibtn0 at acpi0: SLPB
cpu0: Enhanced SpeedStep 1866 MHz: speeds: 1862, 1596 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82Q965 Host" rev 0x02
vga1 at pci0 dev 2 function 0 "Intel 82Q965 Video" rev 0x02
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
intagp0 at vga1
agp0 at intagp0: aperture at 0x80000000, size 0x10000000
inteldrm0 at vga1: apic 2 int 16
drm0 at inteldrm0
"Intel 82Q965 Video" rev 0x02 at pci0 dev 2 function 1 not configured
"Intel 82Q965 HECI" rev 0x02 at pci0 dev 3 function 0 not configured
pciide0 at pci0 dev 3 function 2 "Intel 82Q965 PT IDER" rev 0x02: DMA 
(unsupported), channel 0 wired to native-PCI, channel 1 wired to native-PCI
pciide0: using apic 2 int 18 for native-PCI interrupt
pciide0: channel 0 ignored (not responding; disabled or no drives?)
pciide0: channel 1 ignored (not responding; disabled or no drives?)
"Intel 82Q965 KT" rev 0x02 at pci0 dev 3 function 3 not configured
em0 at pci0 dev 25 function 0 "Intel ICH8 IGP AMT" rev 0x02: msi, address 
00:19:d1:72:f1:8c
uhci0 at pci0 dev 26 function 0 "Intel 82801H USB" rev 0x02: apic 2 int 16
uhci1 at pci0 dev 26 function 1 "Intel 82801H USB" rev 0x02: apic 2 int 21
ehci0 at pci0 dev 26 function 7 "Intel 82801H USB" rev 0x02: apic 2 int 18
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 82801H HD Audio" rev 0x02: msi
azalia0: codecs: Sigmatel STAC9227X
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801H PCIE" rev 0x02: msi
pci1 at ppb0 bus 1
ppb1 at pci0 dev 28 function 1 "Intel 82801H PCIE" rev 0x02: msi
pci2 at ppb1 bus 2
pciide1 at pci2 dev 0 function 0 "Marvell 88SE6101 IDE" rev 0xb1: DMA 
(unsupported), channel 0 configured to native-PCI, channel 1 configured to 
native-PCI
pciide1: using apic 2 int 17 for native-PCI interrupt
pciide1: channel 0 ignored (not responding; disabled or no drives?)
pciide1: channel 1 ignored (not responding; disabled or no drives?)
ppb2 at pci0 dev 28 function 2 "Intel 82801H PCIE" rev 0x02: msi
pci3 at ppb2 bus 3
ppb3 at pci0 dev 28 function 3 "Intel 82801H PCIE" rev 0x02: msi
pci4 at ppb3 bus 4
ppb4 at pci0 dev 28 function 4 "Intel 82801H PCIE" rev 0x02: msi
pci5 at ppb4 bus 5
uhci2 at pci0 dev 29 function 0 "Intel 82801H USB" rev 0x02: apic 2 int 23
uhci3 at pci0 dev 29 function 1 "Intel 82801H USB" rev 0x02: apic 2 int 19
uhci4 at pci0 dev 29 function 2 "Intel 82801H USB" rev 0x02: apic 2 int 18
ehci1 at pci0 dev 29 function 7 "Intel 82801H USB" rev 0x02: apic 2 int 23
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
ppb5 at pci0 dev 30 function 0 "Intel 82801BA Hub-to-PCI" rev 0xf2
pci6 at ppb5 bus 6
"TI TSB43AB22 FireWire" rev 0x00 at pci6 dev 3 function 0 not configured
pcib0 at pci0 dev 31 function 0 "Intel 82801HO LPC" rev 0x02
pciide2 at pci0 dev 31 function 2 "Intel 82801H SATA" rev 0x02: DMA, channel 0 
configured to native-PCI, channel 1 configured to native-PCI
pciide2: using apic 2 int 19 for native-PCI interrupt
wd0 at pciide2 channel 0 drive 0: <WDC WD800JD-00LSA0>
wd0: 16-sector PIO, LBA48, 76319MB, 156301488 sectors
wd0(pciide2:0:0): using PIO mode 4, Ultra-DMA mode 6
ichiic0 at pci0 dev 31 function 3 "Intel 82801H SMBus" rev 0x02: apic 2 int 21
iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 1GB DDR2 SDRAM non-parity PC2-4200CL5
spdmem1 at iic0 addr 0x52: 1GB DDR2 SDRAM non-parity PC2-4200CL5
pciide3 at pci0 dev 31 function 5 "Intel 82801H SATA" rev 0x02: DMA, channel 0 
wired to native-PCI, channel 1 wired to native-PCI
pciide3: using apic 2 int 19 for native-PCI interrupt
usb2 at uhci0: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci1: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci2: USB revision 1.0
uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb5 at uhci3: USB revision 1.0
uhub5 at usb5 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb6 at uhci4: USB revision 1.0
uhub6 at usb6 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
mtrr: Pentium Pro MTRR support
uhidev0 at uhub2 port 1 configuration 1 interface 0 "Cherry Mikroschalter 
product 0x0011" rev 2.00/1.00 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 modifier keys, 6 key codes
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
vscsi0 at root
scsibus0 at vscsi0: 256 targets
softraid0 at root
scsibus1 at softraid0: 256 targets
root on wd0a (239ab09ca538f21a.a) swap on wd0b dump on wd0b
pipex: ppp=0 iface=tun0 protocol=L2TP id=17844 PIPEX is ready.



> 
> Sebastian
> 
> > 
> > Index: sys/net/pipex.c
> > ===================================================================
> > RCS file: /cvs/src/sys/net/pipex.c,v
> > retrieving revision 1.25
> > diff -u -p -r1.25 pipex.c
> > --- sys/net/pipex.c 23 Jan 2012 03:36:21 -0000      1.25
> > +++ sys/net/pipex.c 30 Jan 2012 14:37:31 -0000
> > @@ -2210,13 +2210,16 @@ pipex_l2tp_userland_lookup_session_ipv6(
> >  }
> >  #endif
> >  
> > -Static struct pipex_session *
> > +struct pipex_session *
> >  pipex_l2tp_userland_lookup_session(struct mbuf *m0, struct sockaddr *sa)
> >  {
> >     struct pipex_l2tp_header l2tp;
> >     struct pipex_hash_head *list;
> >     struct pipex_session *session;
> >     uint16_t session_id, tunnel_id, flags;
> > +
> > +   if (sa->sa_family != AF_INET && sa->sa_family != AF_INET6)
> > +           return (NULL);
> >  
> >     /* pullup */
> >     if (m0->m_pkthdr.len < sizeof(l2tp)) {
> > Index: sys/net/pipex.h
> > ===================================================================
> > RCS file: /cvs/src/sys/net/pipex.h,v
> > retrieving revision 1.11
> > diff -u -p -r1.11 pipex.h
> > --- sys/net/pipex.h 23 Jan 2012 03:36:21 -0000      1.11
> > +++ sys/net/pipex.h 30 Jan 2012 14:37:31 -0000
> > @@ -210,6 +210,7 @@ struct pipex_session  *pipex_pptp_lookup
> >  struct mbuf           *pipex_pptp_input (struct mbuf *, struct 
> > pipex_session *);
> >  struct pipex_session  *pipex_pptp_userland_lookup_session_ipv4 (struct 
> > mbuf *, struct in_addr);
> >  struct pipex_session  *pipex_pptp_userland_lookup_session_ipv6 (struct 
> > mbuf *, struct in6_addr);
> > +struct pipex_session  *pipex_l2tp_userland_lookup_session(struct mbuf *, 
> > struct sockaddr *);
> >  struct mbuf           *pipex_pptp_userland_output (struct mbuf *, struct 
> > pipex_session *);
> >  struct pipex_session  *pipex_l2tp_lookup_session (struct mbuf *, int);
> >  struct mbuf           *pipex_l2tp_input (struct mbuf *, int off, struct 
> > pipex_session *);
> > Index: sys/net/pipex_local.h
> > ===================================================================
> > RCS file: /cvs/src/sys/net/pipex_local.h,v
> > retrieving revision 1.14
> > diff -u -p -r1.14 pipex_local.h
> > --- sys/net/pipex_local.h   25 Nov 2011 13:05:06 -0000      1.14
> > +++ sys/net/pipex_local.h   30 Jan 2012 14:37:31 -0000
> > @@ -406,7 +406,6 @@ Static struct pipex_session  *pipex_pptp
> >  
> >  #ifdef PIPEX_L2TP
> >  Static void                  pipex_l2tp_output (struct mbuf *, struct 
> > pipex_session *);
> > -Static struct pipex_session  *pipex_l2tp_userland_lookup_session(struct 
> > mbuf *, struct sockaddr *);
> >  #endif
> >  
> >  #ifdef PIPEX_MPPE
> > Index: sys/netinet/udp_usrreq.c
> > ===================================================================
> > RCS file: /cvs/src/sys/netinet/udp_usrreq.c,v
> > retrieving revision 1.145
> > diff -u -p -r1.145 udp_usrreq.c
> > --- sys/netinet/udp_usrreq.c        8 Jul 2011 18:30:17 -0000       1.145
> > +++ sys/netinet/udp_usrreq.c        30 Jan 2012 14:37:32 -0000
> > @@ -1198,6 +1198,12 @@ udp_usrreq(struct socket *so, int req, s
> >  #ifdef PIPEX
> >             if (inp->inp_pipex) {
> >                     struct pipex_session *session;
> > +
> > +                   if (addr != NULL) 
> > +                           session =
> > +                               pipex_l2tp_userland_lookup_session(m,
> > +                                   mtod(addr, struct sockaddr *));
> > +                   else
> >  #ifdef INET6
> >                     if (inp->inp_flags & INP_IPV6)
> >                             session =

Reply via email to