This commit is contained in:
maxv 2019-09-20 08:45:29 +00:00
parent eead4d4df0
commit 7d15e3a325
2 changed files with 8 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $ */
/* $NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $ */
/* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */
/*
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $");
#ifdef _KERNEL_OPT
#include "ppp.h"
@ -180,19 +180,6 @@ static void pppintr(void *);
extern struct linesw ppp_disc;
/*
* Some useful mbuf macros not in mbuf.h.
*/
#define M_IS_CLUSTER(m) ((m)->m_flags & M_EXT)
#define M_DATASTART(m) \
(M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf : \
(m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
#define M_DATASIZE(m) \
(M_IS_CLUSTER(m) ? (m)->m_ext.ext_size : \
(m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
/*
* We define two link layer specific mbuf flags, to mark high-priority
* packets for output, and received packets following lost/corrupted
@ -1624,7 +1611,7 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
* If the packet will fit in a header mbuf, don't waste a
* whole cluster on it.
*/
if (ilen <= MHLEN && M_IS_CLUSTER(m)) {
if (ilen <= MHLEN && (m->m_flags & M_EXT)) {
MGETHDR(mp, M_DONTWAIT, MT_DATA);
if (mp != NULL) {
m_copydata(m, 0, ilen, mtod(mp, void *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $ */
/* $NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $ */
/* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */
/*
@ -93,7 +93,7 @@
/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $");
#ifdef _KERNEL_OPT
#include "ppp.h"
@ -165,19 +165,6 @@ static void pppdumpb(u_char *b, int l);
static void ppplogchar(struct ppp_softc *, int);
static void pppdumpframe(struct ppp_softc *sc, struct mbuf* m, int xmit);
/*
* Some useful mbuf macros not in mbuf.h.
*/
#define M_IS_CLUSTER(m) ((m)->m_flags & M_EXT)
#define M_DATASTART(m) \
(M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf : \
(m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
#define M_DATASIZE(m) \
(M_IS_CLUSTER(m) ? (m)->m_ext.ext_size : \
(m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
/*
* Does c need to be escaped?
*/
@ -969,7 +956,7 @@ pppgetm(struct ppp_softc *sc)
*mp = m;
MCLGET(m, M_DONTWAIT);
}
len -= M_DATASIZE(m);
len -= M_BUFSIZE(m);
mp = &m->m_next;
}
}
@ -1137,7 +1124,7 @@ pppinput(int c, struct tty *tp)
}
m = sc->sc_m;
m->m_len = 0;
m->m_data = M_DATASTART(sc->sc_m);
MRESETDATA(m);
sc->sc_mc = m;
sc->sc_mp = mtod(m, char *);
sc->sc_fcs = PPP_INITFCS;
@ -1193,7 +1180,7 @@ pppinput(int c, struct tty *tp)
}
sc->sc_mc = m = m->m_next;
m->m_len = 0;
m->m_data = M_DATASTART(m);
MRESETDATA(m);
sc->sc_mp = mtod(m, char *);
}