summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2008-02-06 20:37:34 +0000
committermav <mav@FreeBSD.org>2008-02-06 20:37:34 +0000
commita735f997fd94385d405281134d9c00d45488b3c9 (patch)
tree2c32ea89a7e17808491988c15bba4f3d83cc6d6c /sys/netgraph
parentee907d59aff76187114b99b9243c3e376dc8d71f (diff)
downloadFreeBSD-src-a735f997fd94385d405281134d9c00d45488b3c9.zip
FreeBSD-src-a735f997fd94385d405281134d9c00d45488b3c9.tar.gz
Do not use bcmp() to compare two bytes with constants.
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_ppp.c3
-rw-r--r--sys/netgraph/ng_pppoe.c5
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c
index 5abd492..b83b78f 100644
--- a/sys/netgraph/ng_ppp.c
+++ b/sys/netgraph/ng_ppp.c
@@ -1399,7 +1399,8 @@ ng_ppp_rcvdata(hook_p hook, item_p item)
/* Strip address and control fields, if present. */
if (m->m_len < 2 && (m = m_pullup(m, 2)) == NULL)
ERROUT(ENOBUFS);
- if (bcmp(mtod(m, uint8_t *), &ng_ppp_acf, 2) == 0)
+ if (mtod(m, uint8_t *)[0] == 0xff &&
+ mtod(m, uint8_t *)[1] == 0x03)
m_adj(m, 2);
/* Get protocol number */
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 314e0a4..5d23cfb 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -1179,8 +1179,6 @@ ng_pppoe_rcvdata(hook_p hook, item_p item)
switch (sp->state) {
case PPPOE_NEWCONNECTED:
case PPPOE_CONNECTED: {
- static const u_char addrctrl[] = { 0xff, 0x03 };
-
/*
* Remove PPP address and control fields, if any.
* For example, ng_ppp(4) always sends LCP packets
@@ -1190,7 +1188,8 @@ ng_pppoe_rcvdata(hook_p hook, item_p item)
if (m->m_pkthdr.len >= 2) {
if (m->m_len < 2 && !(m = m_pullup(m, 2)))
LEAVE(ENOBUFS);
- if (bcmp(mtod(m, u_char *), addrctrl, 2) == 0)
+ if (mtod(m, u_char *)[0] == 0xff &&
+ mtod(m, u_char *)[1] == 0x03)
m_adj(m, 2);
}
/*
OpenPOWER on IntegriCloud