Wed Jul 17 10:16:58 2013 UTC ()
if received PADT, get correct sc related with session id.
RFC2516 5.5 says, no tags required in PADT packet.


(oki)
diff -r1.99 -r1.100 src/sys/net/if_pppoe.c

cvs diff -r1.99 -r1.100 src/sys/net/if_pppoe.c (expand / switch to unified diff)

--- src/sys/net/if_pppoe.c 2013/06/29 21:06:58 1.99
+++ src/sys/net/if_pppoe.c 2013/07/17 10:16:58 1.100
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_pppoe.c,v 1.99 2013/06/29 21:06:58 rmind Exp $ */ 1/* $NetBSD: if_pppoe.c,v 1.100 2013/07/17 10:16:58 oki Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Martin Husemann <martin@NetBSD.org>. 8 * by Martin Husemann <martin@NetBSD.org>.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.99 2013/06/29 21:06:58 rmind Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.100 2013/07/17 10:16:58 oki Exp $");
34 34
35#include "pppoe.h" 35#include "pppoe.h"
36#include "opt_pppoe.h" 36#include "opt_pppoe.h"
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/kernel.h> 40#include <sys/kernel.h>
41#include <sys/callout.h> 41#include <sys/callout.h>
42#include <sys/malloc.h> 42#include <sys/malloc.h>
43#include <sys/mbuf.h> 43#include <sys/mbuf.h>
44#include <sys/socket.h> 44#include <sys/socket.h>
45#include <sys/proc.h> 45#include <sys/proc.h>
46#include <sys/ioctl.h> 46#include <sys/ioctl.h>
@@ -707,26 +707,27 @@ breakbreak:; @@ -707,26 +707,27 @@ breakbreak:;
707 break; 707 break;
708 case PPPOE_CODE_PADS: 708 case PPPOE_CODE_PADS:
709 if (sc == NULL) 709 if (sc == NULL)
710 goto done; 710 goto done;
711 sc->sc_session = session; 711 sc->sc_session = session;
712 callout_stop(&sc->sc_timeout); 712 callout_stop(&sc->sc_timeout);
713 if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG) 713 if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
714 printf("%s: session 0x%x connected\n", 714 printf("%s: session 0x%x connected\n",
715 sc->sc_sppp.pp_if.if_xname, session); 715 sc->sc_sppp.pp_if.if_xname, session);
716 sc->sc_state = PPPOE_STATE_SESSION; 716 sc->sc_state = PPPOE_STATE_SESSION;
717 sc->sc_sppp.pp_up(&sc->sc_sppp); /* notify upper layers */ 717 sc->sc_sppp.pp_up(&sc->sc_sppp); /* notify upper layers */
718 break; 718 break;
719 case PPPOE_CODE_PADT: 719 case PPPOE_CODE_PADT:
 720 sc = pppoe_find_softc_by_session(session, m->m_pkthdr.rcvif);
720 if (sc == NULL) 721 if (sc == NULL)
721 goto done; 722 goto done;
722 pppoe_clear_softc(sc, "received PADT"); 723 pppoe_clear_softc(sc, "received PADT");
723 break; 724 break;
724 default: 725 default:
725 printf("%s: unknown code (0x%04x) session = 0x%04x\n", 726 printf("%s: unknown code (0x%04x) session = 0x%04x\n",
726 sc? sc->sc_sppp.pp_if.if_xname : "pppoe", 727 sc? sc->sc_sppp.pp_if.if_xname : "pppoe",
727 ph->code, session); 728 ph->code, session);
728 break; 729 break;
729 } 730 }
730 731
731done: 732done:
732 if (m) 733 if (m)