Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys
Hi,
On 2017/12/17 2:17, Robert Elz wrote:
> 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;
> }
You are right. I fix it by your patch at in_l2tp.c:r1.9 and in6_l2tp.c:r1.12.
Thanks,
--
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.
Device Engineering Section,
IoT Platform Development Department,
Network Division,
Technology Unit
Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>
Home |
Main Index |
Thread Index |
Old Index