summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_pptpgre.c
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2002-06-05 23:35:31 +0000
committerarchie <archie@FreeBSD.org>2002-06-05 23:35:31 +0000
commitd14167a565aab69bc2db27d9d58542b7214b3d26 (patch)
tree79c438e42f33c8b1d1266d5cc137cdd578828f7e /sys/netgraph/ng_pptpgre.c
parenta615d0fcdd4032388124d4b85e81fe3baa903ce5 (diff)
downloadFreeBSD-src-d14167a565aab69bc2db27d9d58542b7214b3d26.zip
FreeBSD-src-d14167a565aab69bc2db27d9d58542b7214b3d26.tar.gz
Const'ify variables to make it clear we're not writing to the mbuf data.
Reviewed by: julian, brian MFC after: 1 week
Diffstat (limited to 'sys/netgraph/ng_pptpgre.c')
-rw-r--r--sys/netgraph/ng_pptpgre.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c
index 1799ad0..d760ed8 100644
--- a/sys/netgraph/ng_pptpgre.c
+++ b/sys/netgraph/ng_pptpgre.c
@@ -569,8 +569,8 @@ ng_pptpgre_recv(node_p node, item_p item)
{
const priv_p priv = NG_NODE_PRIVATE(node);
int iphlen, grelen, extralen;
- struct greheader *gre;
- struct ip *ip;
+ const struct greheader *gre;
+ const struct ip *ip;
int error = 0;
struct mbuf *m;
@@ -595,7 +595,7 @@ bad:
NG_FREE_ITEM(item);
return (ENOBUFS);
}
- ip = mtod(m, struct ip *);
+ ip = mtod(m, const struct ip *);
iphlen = ip->ip_hl << 2;
if (m->m_len < iphlen + sizeof(*gre)) {
if ((m = m_pullup(m, iphlen + sizeof(*gre))) == NULL) {
@@ -603,9 +603,9 @@ bad:
NG_FREE_ITEM(item);
return (ENOBUFS);
}
- ip = mtod(m, struct ip *);
+ ip = mtod(m, const struct ip *);
}
- gre = (struct greheader *)((u_char *)ip + iphlen);
+ gre = (const struct greheader *)((const u_char *)ip + iphlen);
grelen = sizeof(*gre) + sizeof(u_int32_t) * (gre->hasSeq + gre->hasAck);
if (m->m_pkthdr.len < iphlen + grelen) {
priv->stats.recvRunts++;
@@ -617,8 +617,8 @@ bad:
NG_FREE_ITEM(item);
return (ENOBUFS);
}
- ip = mtod(m, struct ip *);
- gre = (struct greheader *)((u_char *)ip + iphlen);
+ ip = mtod(m, const struct ip *);
+ gre = (const struct greheader *)((const u_char *)ip + iphlen);
}
/* Sanity check packet length and GRE header bits */
@@ -628,7 +628,8 @@ bad:
priv->stats.recvBadGRE++;
goto bad;
}
- if ((ntohl(*((u_int32_t *)gre)) & PPTP_INIT_MASK) != PPTP_INIT_VALUE) {
+ if ((ntohl(*((const u_int32_t *)gre)) & PPTP_INIT_MASK)
+ != PPTP_INIT_VALUE) {
priv->stats.recvBadGRE++;
goto bad;
}
OpenPOWER on IntegriCloud