summaryrefslogtreecommitdiffstats
path: root/sys/net/if_spppsubr.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>2001-12-28 23:20:12 +0000
committerjoerg <joerg@FreeBSD.org>2001-12-28 23:20:12 +0000
commit26773395ab051fe35883e9a86f7937e175b08a77 (patch)
treeb8b348667bdc1052afc8900eebf6d48aab91f6aa /sys/net/if_spppsubr.c
parent993dd6cae8aeb291e5b42649fb73e2dd06bea74d (diff)
downloadFreeBSD-src-26773395ab051fe35883e9a86f7937e175b08a77.zip
FreeBSD-src-26773395ab051fe35883e9a86f7937e175b08a77.tar.gz
Fix my breakage to the low-level hardware sync drivers brought by the
inclusion of VJ compression into sppp. Now, instead of the need to include this and that and everything plus the kitchensink in each of those drivers, struct sppp uses struct slcompress as an opaque structure only referenced by a pointer. The actual structure is then malloced at initialization time. While i was at it, also fixed a bug where received VJ packets would only be recognized if INET6 was defined.
Diffstat (limited to 'sys/net/if_spppsubr.c')
-rw-r--r--sys/net/if_spppsubr.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 0c6d343..23c8ac8 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -80,8 +80,6 @@
# else
# include <net/ethertypes.h>
# endif
-#else
-# error Huh? sppp without INET?
#endif
#ifdef IPX
@@ -586,33 +584,19 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
}
do_account++;
break;
-#endif
-#ifdef INET6
- case PPP_IPV6CP:
- if (sp->pp_phase == PHASE_NETWORK)
- sppp_cp_input(&ipv6cp, sp, m);
- m_freem (m);
- return;
-
- case PPP_IPV6:
- if (sp->state[IDX_IPV6CP] == STATE_OPENED) {
- schednetisr (NETISR_IPV6);
- inq = &ip6intrq;
- }
- do_account++;
- break;
case PPP_VJ_COMP:
if (sp->state[IDX_IPCP] == STATE_OPENED) {
if ((len =
sl_uncompress_tcp((u_char **)&m->m_data,
m->m_len,
TYPE_COMPRESSED_TCP,
- &sp->pp_comp)) <= 0)
+ sp->pp_comp)) <= 0)
goto drop;
m->m_len = m->m_pkthdr.len = len;
schednetisr (NETISR_IP);
inq = &ipintrq;
}
+ do_account++;
break;
case PPP_VJ_UCOMP:
if (sp->state[IDX_IPCP] == STATE_OPENED) {
@@ -620,12 +604,28 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
sl_uncompress_tcp((u_char **)&m->m_data,
m->m_len,
TYPE_UNCOMPRESSED_TCP,
- &sp->pp_comp)) <= 0)
+ sp->pp_comp)) <= 0)
goto drop;
m->m_len = m->m_pkthdr.len = len;
schednetisr (NETISR_IP);
inq = &ipintrq;
}
+ do_account++;
+ break;
+#endif
+#ifdef INET6
+ case PPP_IPV6CP:
+ if (sp->pp_phase == PHASE_NETWORK)
+ sppp_cp_input(&ipv6cp, sp, m);
+ m_freem (m);
+ return;
+
+ case PPP_IPV6:
+ if (sp->state[IDX_IPV6CP] == STATE_OPENED) {
+ schednetisr (NETISR_IPV6);
+ inq = &ip6intrq;
+ }
+ do_account++;
break;
#endif
#ifdef IPX
@@ -814,7 +814,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
*/
if (sp->pp_mode != IFF_CISCO && (sp->ipcp.flags & IPCP_VJ) &&
ip->ip_p == IPPROTO_TCP)
- switch (sl_compress_tcp(m, ip, &sp->pp_comp,
+ switch (sl_compress_tcp(m, ip, sp->pp_comp,
sp->ipcp.compress_cid)) {
case TYPE_COMPRESSED_TCP:
ipproto = PPP_VJ_COMP;
@@ -974,9 +974,10 @@ sppp_attach(struct ifnet *ifp)
sp->pp_down = lcp.Down;
mtx_init(&sp->pp_cpq.ifq_mtx, "sppp_cpq", MTX_DEF);
mtx_init(&sp->pp_fastq.ifq_mtx, "sppp_fastq", MTX_DEF);
- sp->enable_vj = 1;
sp->pp_last_recv = sp->pp_last_sent = time_second;
- sl_compress_init(&sp->pp_comp, -1);
+ sp->enable_vj = 1;
+ sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, M_WAIT);
+ sl_compress_init(sp->pp_comp, -1);
sppp_lcp_init(sp);
sppp_ipcp_init(sp);
sppp_ipv6cp_init(sp);
@@ -2931,7 +2932,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
if (debug)
log(-1, "VJ [ack] ");
sp->ipcp.flags |= IPCP_VJ;
- sl_compress_init(&sp->pp_comp, p[4]);
+ sl_compress_init(sp->pp_comp, p[4]);
sp->ipcp.max_state = p[4];
sp->ipcp.compress_cid = p[5];
continue;
@@ -3108,7 +3109,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
log(-1, "[wantcomp %#04x] ",
desiredcomp);
if (desiredcomp == IPCP_COMP_VJ) {
- sl_compress_init(&sp->pp_comp, p[4]);
+ sl_compress_init(sp->pp_comp, p[4]);
sp->ipcp.max_state = p[4];
sp->ipcp.compress_cid = p[5];
if (debug)
@@ -4782,7 +4783,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
}
#endif
}
-}
+}
#ifdef INET6
/*
OpenPOWER on IntegriCloud