summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_mppc.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2007-05-04 16:05:58 +0000
committermav <mav@FreeBSD.org>2007-05-04 16:05:58 +0000
commit9f72209bd224af507e0aebfb47c02acfd920e7ce (patch)
tree7f09018632fbcfc4641e1514aa99b95a92544b76 /sys/netgraph/ng_mppc.c
parentb75fdc8954baff1ea5c13bb10a96287b9808562b (diff)
downloadFreeBSD-src-9f72209bd224af507e0aebfb47c02acfd920e7ce.zip
FreeBSD-src-9f72209bd224af507e0aebfb47c02acfd920e7ce.tar.gz
Make coherency counter 12bit as it should
Approved by: glebius (mentor)
Diffstat (limited to 'sys/netgraph/ng_mppc.c')
-rw-r--r--sys/netgraph/ng_mppc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netgraph/ng_mppc.c b/sys/netgraph/ng_mppc.c
index b693ef1..71c1f72 100644
--- a/sys/netgraph/ng_mppc.c
+++ b/sys/netgraph/ng_mppc.c
@@ -113,6 +113,8 @@ MALLOC_DEFINE(M_NETGRAPH_MPPC, "netgraph_mppc", "netgraph mppc node ");
#define MPPC_FLAG_ENCRYPTED 0x1000 /* packet is encrypted */
#define MPPC_CCOUNT_MASK 0x0fff /* sequence number mask */
+#define MPPC_CCOUNT_INC(d) ((d) = (((d) + 1) & MPPC_CCOUNT_MASK))
+
#define MPPE_UPDATE_MASK 0xff /* coherency count when we're */
#define MPPE_UPDATE_FLAG 0xff /* supposed to update key */
@@ -563,8 +565,8 @@ ng_mppc_compress(node_p node, struct mbuf *m, struct mbuf **resultp)
}
#endif
- /* Update sequence number */
- d->cc++;
+ /* Update coherency count for next time (12 bit arithmetic) */
+ MPPC_CCOUNT_INC(d->cc);
/* Install header */
*((u_int16_t *)outbuf) = htons(header);
@@ -635,7 +637,7 @@ ng_mppc_decompress(node_p node, struct mbuf *m, struct mbuf **resultp)
ng_mppc_updatekey(d->cfg.bits,
d->cfg.startkey, d->key, &d->rc4);
}
- d->cc++;
+ MPPC_CCOUNT_INC(d->cc);
}
/* Reset key (except in stateless mode, see below) */
@@ -683,7 +685,7 @@ ng_mppc_decompress(node_p node, struct mbuf *m, struct mbuf **resultp)
}
/* Update coherency count for next time (12 bit arithmetic) */
- d->cc++;
+ MPPC_CCOUNT_INC(d->cc);
/* Check for unexpected compressed packet */
if ((header & MPPC_FLAG_COMPRESSED) != 0
OpenPOWER on IntegriCloud