Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/net Pull up following revision(s) (requested by marti...
details: https://anonhg.NetBSD.org/src/rev/36c024b30640
branches: netbsd-3
changeset: 577800:36c024b30640
user: tron <tron%NetBSD.org@localhost>
date: Wed Feb 01 20:43:25 2006 +0000
description:
Pull up following revision(s) (requested by martin in ticket #1152):
sys/net/if_pppoe.c: revision 1.64
Make sure error messages (received from the access concentrator) are
zero terminated.
diffstat:
sys/net/if_pppoe.c | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diffs (87 lines):
diff -r 644688ec858e -r 36c024b30640 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c Wed Feb 01 20:41:19 2006 +0000
+++ b/sys/net/if_pppoe.c Wed Feb 01 20:43:25 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.59 2005/02/26 22:45:09 perry Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.59.2.1 2006/02/01 20:43:25 tron Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.59 2005/02/26 22:45:09 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.59.2.1 2006/02/01 20:43:25 tron Exp $");
#include "pppoe.h"
#include "bpfilter.h"
@@ -419,7 +419,8 @@
u_int16_t tag, len;
u_int16_t session, plen;
struct pppoe_softc *sc;
- const char *err_msg, *err_txt;
+ const char *err_msg, *devname;
+ char *error;
u_int8_t *ac_cookie;
size_t ac_cookie_len;
#ifdef PPPOE_SERVER
@@ -432,7 +433,8 @@
int noff, err, errortag;
struct ether_header *eh;
- err_msg = err_txt = NULL;
+ devname = "pppoe"; /* as long as we don't know which instance */
+ err_msg = NULL;
errortag = 0;
if (m->m_len < sizeof(*eh)) {
m = m_pullup(m, sizeof(*eh));
@@ -482,8 +484,7 @@
while (off + sizeof(*pt) <= m->m_pkthdr.len) {
n = m_pulldown(m, off, sizeof(*pt), &noff);
if (!n) {
- printf("%s: parse error\n",
- sc ? sc->sc_sppp.pp_if.if_xname : "pppoe");
+ printf("%s: parse error\n", devname);
m = NULL;
goto done;
}
@@ -517,6 +518,8 @@
#endif
sc = pppoe_find_softc_by_hunique(mtod(n, caddr_t) + noff,
len, m->m_pkthdr.rcvif);
+ if (sc != NULL)
+ devname = sc->sc_sppp.pp_if.if_xname;
break;
case PPPOE_TAG_ACCOOKIE:
if (ac_cookie == NULL) {
@@ -545,16 +548,23 @@
break;
}
if (err_msg) {
- err_txt = "";
+ error = NULL;
if (errortag && len) {
+ error = malloc(len+1, M_TEMP, M_NOWAIT);
n = m_pulldown(m, off + sizeof(*pt), len,
&noff);
- if (n)
- err_txt = mtod(n, caddr_t) + noff;
+ if (n && error) {
+ strncpy(error,
+ mtod(n, caddr_t) + noff, len);
+ error[len-1] = '\0';
+ }
}
- printf("%s: %s: %*s\n",
- sc ? sc->sc_sppp.pp_if.if_xname : "pppoe*",
- err_msg, len, err_txt);
+ if (error) {
+ printf("%s: %s: %s\n", devname,
+ err_msg, error);
+ free(error, M_TEMP);
+ } else
+ printf("%s: %s\n", devname, err_msg);
if (errortag)
goto done;
}
Home |
Main Index |
Thread Index |
Old Index