netgraph/pppoe: fix panic in session lookup

Submitted by: Alex Dupre <ale@FreeBSD.org>
PR:           https://forum.opnsense.org/index.php?topic=5697.0
See also:     https://reviews.freebsd.org/D9270

(cherry picked from commit 1511b8ac7b)
This commit is contained in:
Franco Fichtner 2017-08-25 08:56:49 +02:00
parent 0039145f67
commit 02581be962

View file

@ -613,6 +613,9 @@ pppoe_finduniq(node_p node, const struct pppoe_tag *tag)
if (NG_HOOK_PRIVATE(hook) == NULL)
continue;
sp = NG_HOOK_PRIVATE(hook);
/* Skip already connected sessions. */
if (sp->neg == NULL)
continue;
if (sp->neg->host_uniq_len == ntohs(tag->tag_len) &&
bcmp(sp->neg->host_uniq.data, (const char *)(tag + 1),
sp->neg->host_uniq_len) == 0)