Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys
Date: Fri, 15 Dec 2017 21:24:20 +0700
From: Robert Elz <kre%munnari.OZ.AU@localhost>
Message-ID: <11642.1513347860%andromeda.noi.kre.to@localhost>
| Unfortunately, because of the way it gets called, this might not be an
| easy change to make.
It wouldn't be, but it also turns out to be (I think) unnecessary.
The m_pullup() (or equiv) isn't needed at all, as you determined initially,
m_copydata() handles fetching data from multiple mbufs (or an external
cluster if needed).
The problem with your first fix was that you were checking whether the
current mbuf contained the session-ID which it might not, it could be
later - but we really do not need to care (and if it isn't there we
do not need to fix it).
What I'd suggest doing (and the same for the inet6 case) is to make the
function be ...
[aside don't cut& paste from this e-mail, it will have had most tabs
turned into spaces...]
static int
in_l2tp_match(struct mbuf *m, int off, int proto, void *arg)
{
struct l2tp_variant *var = arg;
uint32_t sess_id;
KASSERT(proto == IPPROTO_L2TP);
/*
* If the packet contains no session ID it cannot match
*/
if (m_length(m) < off + sizeof(uint32_t))
return 0;
/* get L2TP session ID */
m_copydata(m, off, sizeof(uint32_t), (void *)&sess_id);
NTOHL(sess_id);
if (sess_id == 0) {
/*
* L2TPv3 control packet received.
* userland daemon(l2tpd?) should process.
*/
return 32 * 2;
} else if (sess_id == var->lv_my_sess_id)
return 32 * 2;
else
return 0;
}
David Brownlee <abs%absd.org@localhost> said:
| Just wondering, is there scope for a (rather heavy) debug option in which
| m_ensure_contig() always returns a new mbuf for valid input?
Seems like it might be something worthwhile to try, but that decision
I would leave to those who play in the network stackbox day in and day out.
kre
Home |
Main Index |
Thread Index |
Old Index