aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorArchie Cobbs <archie@FreeBSD.org>1999-11-19 04:27:53 +0000
committerArchie Cobbs <archie@FreeBSD.org>1999-11-19 04:27:53 +0000
commit19a52c592d5a31736edfac1bfbef2a0b1fab5d52 (patch)
tree3dfec27a03db3e5a717dda7375e4acc50fdf5432 /sys/netgraph
parent3a58352eb0767d173ff694ec512197e44cc18f58 (diff)
downloadsrc-19a52c592d5a31736edfac1bfbef2a0b1fab5d52.tar.gz
src-19a52c592d5a31736edfac1bfbef2a0b1fab5d52.zip
Remove the address and control field compression functionality of this
node type. ACF is device independent and therefore belongs in ng_ppp.c (which already implements it).
Notes
Notes: svn path=/head/; revision=53394
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_async.c48
-rw-r--r--sys/netgraph/ng_async.h3
2 files changed, 17 insertions, 34 deletions
diff --git a/sys/netgraph/ng_async.c b/sys/netgraph/ng_async.c
index 397e7e757681..ca96dbe72f14 100644
--- a/sys/netgraph/ng_async.c
+++ b/sys/netgraph/ng_async.c
@@ -64,16 +64,13 @@
#include <net/ppp_defs.h>
-/* LCP protocol number */
-#define PROTO_LCP 0xc021
-
/* Async decode state */
#define MODE_HUNT 0
#define MODE_NORMAL 1
#define MODE_ESC 2
/* Private data structure */
-struct private {
+struct ng_async_private {
node_p node; /* Our node */
hook_p async; /* Asynchronous side */
hook_p sync; /* Synchronous side */
@@ -86,7 +83,7 @@ struct private {
struct ng_async_cfg cfg; /* Configuration */
struct ng_async_stat stats; /* Statistics */
};
-typedef struct private *sc_p;
+typedef struct ng_async_private *sc_p;
/* Useful macros */
#define ASYNC_BUF_SIZE(smru) (2 * (smru) + 10)
@@ -238,7 +235,6 @@ nga_rcvmsg(node_p node, struct ng_mesg *msg,
|| cfg->smru > NG_ASYNC_MAX_MRU)
ERROUT(EINVAL);
cfg->enabled = !!cfg->enabled; /* normalize */
- cfg->acfcomp = !!cfg->acfcomp; /* normalize */
if (cfg->smru > sc->cfg.smru) { /* reallocate buffer */
MALLOC(buf, u_char *, ASYNC_BUF_SIZE(cfg->smru),
M_NETGRAPH, M_NOWAIT);
@@ -358,7 +354,7 @@ static int
nga_rcv_sync(const sc_p sc, struct mbuf *m, meta_p meta)
{
struct ifnet *const rcvif = m->m_pkthdr.rcvif;
- int acfcomp, alen, error = 0;
+ int alen, error = 0;
struct timeval time;
u_int16_t fcs, fcs0;
u_int32_t accm;
@@ -371,28 +367,20 @@ nga_rcv_sync(const sc_p sc, struct mbuf *m, meta_p meta)
return (error);
}
- /* Defaults for ACF compression and ACCM */
+ /* Get ACCM; special case LCP frames, which use full ACCM */
accm = sc->cfg.accm;
- acfcomp = sc->cfg.acfcomp;
-
- /* Special case LCP frames: disable ACF and enable ACCM */
- {
- struct mbuf *n = m;
- int off, proto;
-
- for (proto = off = 0; (proto & 1) == 0; off++) {
- while (n != NULL && off >= n->m_len) {
- n = n->m_next;
- off = 0;
- }
- if (n == NULL)
- break;
- proto = (proto << 8) | mtod(n, u_char *)[off];
- }
- if (proto == PROTO_LCP) {
+ if (m->m_pkthdr.len >= 4) {
+ static const u_char lcphdr[4] = {
+ PPP_ALLSTATIONS,
+ PPP_UI,
+ (u_char)(PPP_LCP >> 8),
+ (u_char)(PPP_LCP & 0xff)
+ };
+ u_char buf[4];
+
+ m_copydata(m, 0, 4, (caddr_t)buf);
+ if (bcmp(buf, &lcphdr, 4) == 0)
accm = ~0;
- acfcomp = 0;
- }
}
/* Check for overflow */
@@ -417,11 +405,7 @@ nga_rcv_sync(const sc_p sc, struct mbuf *m, meta_p meta)
sc->lasttime = time.tv_sec;
}
- /* Add option address and control fields, then packet payload */
- if (!acfcomp) {
- ADD_BYTE(PPP_ALLSTATIONS);
- ADD_BYTE(PPP_UI);
- }
+ /* Add packet payload */
while (m != NULL) {
struct mbuf *n;
diff --git a/sys/netgraph/ng_async.h b/sys/netgraph/ng_async.h
index 008cf2eb4ea5..6df6620484bb 100644
--- a/sys/netgraph/ng_async.h
+++ b/sys/netgraph/ng_async.h
@@ -45,7 +45,7 @@
/* Type name and cookie */
#define NG_ASYNC_NODE_TYPE "async"
-#define NGM_ASYNC_COOKIE 886473716
+#define NGM_ASYNC_COOKIE 886473717
/* Hook names */
#define NG_ASYNC_HOOK_SYNC "sync" /* Sync frames */
@@ -71,7 +71,6 @@ struct ng_async_stat {
/* Configuration for this node */
struct ng_async_cfg {
u_char enabled; /* Turn encoding on/off */
- u_char acfcomp; /* Address/control field compression */
u_int16_t amru; /* Max receive async frame length */
u_int16_t smru; /* Max receive sync frame length */
u_int32_t accm; /* ACCM encoding */