Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Add support for RFC 4638 to pppoe(4).
details: https://anonhg.NetBSD.org/src/rev/a962862d5156
branches: trunk
changeset: 769272:a962862d5156
user: rjs <rjs%NetBSD.org@localhost>
date: Mon Sep 05 12:19:09 2011 +0000
description:
Add support for RFC 4638 to pppoe(4).
The change to if_spppsubr.c moves the test for whether LCP should
request a mru change until after the pppoe device has picked up the
mtu of the underlying ethernet device.
diffstat:
sys/net/if_pppoe.c | 27 ++++++++++++++++++++++++---
sys/net/if_spppsubr.c | 17 +++++++++--------
2 files changed, 33 insertions(+), 11 deletions(-)
diffs (128 lines):
diff -r 42523e818d33 -r a962862d5156 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c Mon Sep 05 12:04:40 2011 +0000
+++ b/sys/net/if_pppoe.c Mon Sep 05 12:19:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.97 2011/08/30 22:23:06 rjs Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.98 2011/09/05 12:19:09 rjs Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.97 2011/08/30 22:23:06 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.98 2011/09/05 12:19:09 rjs Exp $");
#include "pppoe.h"
#include "opt_pfil_hooks.h"
@@ -85,6 +85,7 @@
#define PPPOE_TAG_ACCOOKIE 0x0104 /* AC cookie */
#define PPPOE_TAG_VENDOR 0x0105 /* vendor specific */
#define PPPOE_TAG_RELAYSID 0x0110 /* relay session id */
+#define PPPOE_TAG_MAX_PAYLOAD 0x0120 /* max payload */
#define PPPOE_TAG_SNAME_ERR 0x0201 /* service name error */
#define PPPOE_TAG_ACSYS_ERR 0x0202 /* AC system error */
#define PPPOE_TAG_GENERIC_ERR 0x0203 /* generic error */
@@ -895,7 +896,7 @@
return ENXIO;
}
- if (sc->sc_sppp.pp_if.if_mtu >
+ if (sc->sc_sppp.pp_if.if_mtu !=
eth_if->if_mtu - PPPOE_OVERHEAD) {
sc->sc_sppp.pp_if.if_mtu = eth_if->if_mtu -
PPPOE_OVERHEAD;
@@ -1041,6 +1042,9 @@
l2 = strlen(sc->sc_concentrator_name);
len += 2 + 2 + l2;
}
+ if (sc->sc_sppp.pp_if.if_mtu > PPPOE_MAXMTU) {
+ len += 2 + 2 + 2;
+ }
/* allocate a buffer */
m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN); /* header len + payload len */
@@ -1067,6 +1071,13 @@
PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
PPPOE_ADD_16(p, sizeof(sc));
memcpy(p, &sc, sizeof sc);
+ p += sizeof(sc);
+
+ if (sc->sc_sppp.pp_if.if_mtu > PPPOE_MAXMTU) {
+ PPPOE_ADD_16(p, PPPOE_TAG_MAX_PAYLOAD);
+ PPPOE_ADD_16(p, 2);
+ PPPOE_ADD_16(p, (uint16_t)sc->sc_sppp.pp_if.if_mtu);
+ }
#ifdef PPPOE_DEBUG
p += sizeof sc;
@@ -1283,6 +1294,9 @@
len += 2 + 2 + sc->sc_ac_cookie_len; /* AC cookie */
if (sc->sc_relay_sid_len > 0)
len += 2 + 2 + sc->sc_relay_sid_len; /* Relay SID */
+ if (sc->sc_sppp.pp_if.if_mtu > PPPOE_MAXMTU) {
+ len += 2 + 2 + 2;
+ }
m0 = pppoe_get_mbuf(len + PPPOE_HEADERLEN);
if (!m0)
return ENOBUFS;
@@ -1311,6 +1325,13 @@
PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
PPPOE_ADD_16(p, sizeof(sc));
memcpy(p, &sc, sizeof sc);
+ p += sizeof(sc);
+
+ if (sc->sc_sppp.pp_if.if_mtu > PPPOE_MAXMTU) {
+ PPPOE_ADD_16(p, PPPOE_TAG_MAX_PAYLOAD);
+ PPPOE_ADD_16(p, 2);
+ PPPOE_ADD_16(p, (uint16_t)sc->sc_sppp.pp_if.if_mtu);
+ }
#ifdef PPPOE_DEBUG
p += sizeof sc;
diff -r 42523e818d33 -r a962862d5156 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c Mon Sep 05 12:04:40 2011 +0000
+++ b/sys/net/if_spppsubr.c Mon Sep 05 12:19:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_spppsubr.c,v 1.121 2011/07/17 20:54:52 joerg Exp $ */
+/* $NetBSD: if_spppsubr.c,v 1.122 2011/09/05 12:19:09 rjs Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.121 2011/07/17 20:54:52 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.122 2011/09/05 12:19:09 rjs Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -2000,12 +2000,6 @@
sp->pp_seq[IDX_LCP] = 0;
sp->pp_rseq[IDX_LCP] = 0;
sp->lcp.protos = 0;
- if (sp->pp_if.if_mtu < PP_MTU) {
- sp->lcp.mru = sp->pp_if.if_mtu;
- sp->lcp.opts |= (1 << LCP_OPT_MRU);
- } else
- sp->lcp.mru = PP_MTU;
- sp->lcp.their_mru = PP_MTU;
/*
* Initialize counters and timeout values. Note that we don't
@@ -2090,6 +2084,13 @@
static void
sppp_lcp_open(struct sppp *sp)
{
+ if (sp->pp_if.if_mtu < PP_MTU) {
+ sp->lcp.mru = sp->pp_if.if_mtu;
+ sp->lcp.opts |= (1 << LCP_OPT_MRU);
+ } else
+ sp->lcp.mru = PP_MTU;
+ sp->lcp.their_mru = PP_MTU;
+
/*
* If we are authenticator, negotiate LCP_AUTH
*/
Home |
Main Index |
Thread Index |
Old Index