summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/sys/sysctl.228
-rw-r--r--sys/net/if.c9
-rw-r--r--sys/net/netisr.h4
-rw-r--r--sys/net/pipex.c141
-rw-r--r--sys/net/pipex.h8
-rw-r--r--sys/net/pipex_local.h5
6 files changed, 38 insertions, 157 deletions
diff --git a/lib/libc/sys/sysctl.2 b/lib/libc/sys/sysctl.2
index 2e1b085ae78..0b9be238c59 100644
--- a/lib/libc/sys/sysctl.2
+++ b/lib/libc/sys/sysctl.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.2,v 1.40 2020/05/17 05:48:39 ratchov Exp $
+.\" $OpenBSD: sysctl.2,v 1.41 2020/08/04 09:32:05 mvs Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 17 2020 $
+.Dd $Mdocdate: August 4 2020 $
.Dt SYSCTL 2
.Os
.Sh NAME
@@ -2033,35 +2033,11 @@ The currently defined variable names are:
.Bl -column "Third level name" "integer" "Changeable" -offset indent
.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
.It Dv PIPEXCTL_ENABLE Ta integer Ta yes
-.It Dv PIPEXCTL_INQ Ta node Ta not applicable
-.It Dv PIPEXCTL_OUTQ Ta node Ta not applicable
.El
.Bl -tag -width "123456"
.It Dv PIPEXCTL_ENABLE
If set to 1, enable PIPEX processing.
The default is 0.
-.It Dv PIPEXCTL_INQ Pq Va net.pipex.inq
-Fourth level comprises an array of
-.Vt struct ifqueue
-structures containing information about the PIPEX packet input queue.
-The forth level names for the elements of
-.Vt struct ifqueue
-are the same as described in
-.Li ip.arpq
-in the
-.Dv PF_INET
-section.
-.It Dv PIPEXCTL_OUTQ Pq Va net.pipex.outq
-Fourth level comprises an array of
-.Vt struct ifqueue
-structures containing information about PIPEX packet output queue.
-The forth level names for the elements of
-.Vt struct ifqueue
-are the same as described in
-.Li ip.arpq
-in the
-.Dv PF_INET
-section.
.El
.El
.Ss CTL_VFS
diff --git a/sys/net/if.c b/sys/net/if.c
index a38bd144869..41889efbe5e 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.616 2020/07/24 18:17:14 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.617 2020/08/04 09:32:05 mvs Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -909,13 +909,6 @@ if_netisr(void *unused)
KERNEL_UNLOCK();
}
#endif
-#ifdef PIPEX
- if (n & (1 << NETISR_PIPEX)) {
- KERNEL_LOCK();
- pipexintr();
- KERNEL_UNLOCK();
- }
-#endif
t |= n;
}
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index f5746af9243..9f34bac6123 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netisr.h,v 1.51 2019/08/06 22:57:54 bluhm Exp $ */
+/* $OpenBSD: netisr.h,v 1.52 2020/08/04 09:32:05 mvs Exp $ */
/* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */
/*
@@ -48,7 +48,6 @@
#define NETISR_IPV6 24 /* same as AF_INET6 */
#define NETISR_ISDN 26 /* same as AF_E164 */
#define NETISR_PPP 28 /* for PPP processing */
-#define NETISR_PIPEX 27 /* for pipex processing */
#define NETISR_BRIDGE 29 /* for bridge processing */
#define NETISR_PPPOE 30 /* for pppoe processing */
#define NETISR_SWITCH 31 /* for switch dataplane */
@@ -68,7 +67,6 @@ void bridgeintr(void);
void pppoeintr(void);
void switchintr(void);
void pfsyncintr(void);
-void pipexintr(void);
#define schednetisr(anisr) \
do { \
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 2ad7757fee9..823c414098b 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.122 2020/07/29 12:09:31 mvs Exp $ */
+/* $OpenBSD: pipex.c,v 1.123 2020/08/04 09:32:05 mvs Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -102,10 +102,6 @@ struct radix_node_head *pipex_rd_head6 = NULL; /* [N] */
struct timeout pipex_timer_ch; /* callout timer context */
int pipex_prune = 1; /* [I] walk list every seconds */
-/* pipex traffic queue */
-struct mbuf_queue pipexinq = MBUF_QUEUE_INITIALIZER(IFQ_MAXLEN, IPL_NET);
-struct mbuf_queue pipexoutq = MBUF_QUEUE_INITIALIZER(IFQ_MAXLEN, IPL_NET);
-
/* borrow an mbuf pkthdr field */
#define ph_ppp_proto ether_vtag
@@ -725,82 +721,6 @@ pipex_lookup_by_session_id(int protocol, int session_id)
}
/***********************************************************************
- * Queue and Software Interrupt Handler
- ***********************************************************************/
-void
-pipexintr(void)
-{
- struct pipex_session *pkt_session;
- u_int16_t proto;
- struct mbuf *m;
- struct mbuf_list ml;
-
- /* ppp output */
- mq_delist(&pipexoutq, &ml);
- while ((m = ml_dequeue(&ml)) != NULL) {
- pkt_session = m->m_pkthdr.ph_cookie;
- if (pkt_session == NULL) {
- m_freem(m);
- continue;
- }
- proto = m->m_pkthdr.ph_ppp_proto;
-
- m->m_pkthdr.ph_cookie = NULL;
- m->m_pkthdr.ph_ppp_proto = 0;
-
- if (pkt_session->is_multicast != 0) {
- struct pipex_session *session;
- struct mbuf *m0;
-
- LIST_FOREACH(session, &pipex_session_list,
- session_list) {
- if (session->pipex_iface !=
- pkt_session->pipex_iface)
- continue;
- if (session->ip_forward == 0 &&
- session->ip6_forward == 0)
- continue;
- m0 = m_copym(m, 0, M_COPYALL, M_NOWAIT);
- if (m0 == NULL) {
- session->stat.oerrors++;
- continue;
- }
- pipex_ppp_output(m0, session, proto);
- }
- m_freem(m);
- } else
- pipex_ppp_output(m, pkt_session, proto);
- }
-
- /* ppp input */
- mq_delist(&pipexinq, &ml);
- while ((m = ml_dequeue(&ml)) != NULL) {
- pkt_session = m->m_pkthdr.ph_cookie;
- if (pkt_session == NULL) {
- m_freem(m);
- continue;
- }
- pipex_ppp_input(m, pkt_session, 0);
- }
-}
-
-Static int
-pipex_ppp_enqueue(struct mbuf *m0, struct pipex_session *session,
- struct mbuf_queue *mq)
-{
- m0->m_pkthdr.ph_cookie = session;
- /* XXX need to support other protocols */
- m0->m_pkthdr.ph_ppp_proto = PPP_IP;
-
- if (mq_enqueue(mq, m0) != 0)
- return (1);
-
- schednetisr(NETISR_PIPEX);
-
- return (0);
-}
-
-/***********************************************************************
* Timer functions
***********************************************************************/
Static void
@@ -852,13 +772,6 @@ pipex_timer(void *ignored_arg)
/* FALLTHROUGH */
case PIPEX_STATE_CLOSED:
- /*
- * mbuf queued in pipexinq or pipexoutq may have a
- * refererce to this session.
- */
- if (!mq_empty(&pipexinq) || !mq_empty(&pipexoutq))
- continue;
-
pipex_destroy_session(session);
break;
@@ -958,12 +871,29 @@ pipex_ip_output(struct mbuf *m0, struct pipex_session *session)
if (m0 == NULL)
goto dropped;
}
- } else
+
+ pipex_ppp_output(m0, session, PPP_IP);
+ } else {
+ struct pipex_session *session_tmp;
+ struct mbuf *m;
+
m0->m_flags &= ~(M_BCAST|M_MCAST);
- /* output ip packets to the session tunnel */
- if (pipex_ppp_enqueue(m0, session, &pipexoutq))
- goto dropped;
+ LIST_FOREACH(session_tmp, &pipex_session_list, session_list) {
+ if (session_tmp->pipex_iface != session->pipex_iface)
+ continue;
+ if (session_tmp->ip_forward == 0 &&
+ session_tmp->ip6_forward == 0)
+ continue;
+ m = m_copym(m0, 0, M_COPYALL, M_NOWAIT);
+ if (m == NULL) {
+ session_tmp->stat.oerrors++;
+ continue;
+ }
+ pipex_ppp_output(m, session_tmp, PPP_IP);
+ }
+ m_freem(m0);
+ }
return;
drop:
@@ -1241,7 +1171,7 @@ drop:
Static struct mbuf *
pipex_common_input(struct pipex_session *session, struct mbuf *m0, int hlen,
- int plen, int useq)
+ int plen)
{
int proto, ppphlen;
u_char code;
@@ -1289,19 +1219,12 @@ pipex_common_input(struct pipex_session *session, struct mbuf *m0, int hlen,
m_adj(m0, plen - m0->m_pkthdr.len);
}
- if (!useq) {
- pipex_ppp_input(m0, session, 0);
- return (NULL);
- }
+ pipex_ppp_input(m0, session, 0);
+
+ return (NULL);
- /* input ppp packets to kernel session */
- if (pipex_ppp_enqueue(m0, session, &pipexinq) != 0)
- goto dropped;
- else
- return (NULL);
drop:
m_freem(m0);
-dropped:
session->stat.ierrors++;
return (NULL);
@@ -1398,7 +1321,7 @@ pipex_pppoe_input(struct mbuf *m0, struct pipex_session *session)
sizeof(struct pipex_pppoe_header), (caddr_t)&pppoe);
hlen = sizeof(struct ether_header) + sizeof(struct pipex_pppoe_header);
- if ((m0 = pipex_common_input(session, m0, hlen, ntohs(pppoe.length), 0))
+ if ((m0 = pipex_common_input(session, m0, hlen, ntohs(pppoe.length)))
== NULL)
return (NULL);
m_freem(m0);
@@ -1694,7 +1617,7 @@ pipex_pptp_input(struct mbuf *m0, struct pipex_session *session)
pipex_pptp_output(NULL, session, 0, 1);
}
- if ((m0 = pipex_common_input(session, m0, hlen, ntohs(gre->len), 1))
+ if ((m0 = pipex_common_input(session, m0, hlen, ntohs(gre->len)))
== NULL) {
/* ok, The packet is for PIPEX */
if (!rewind)
@@ -2129,7 +2052,7 @@ pipex_l2tp_input(struct mbuf *m0, int off0, struct pipex_session *session,
length -= hlen + offset;
hlen += off0 + offset;
- if ((m0 = pipex_common_input(session, m0, hlen, length, 1)) == NULL) {
+ if ((m0 = pipex_common_input(session, m0, hlen, length)) == NULL) {
/* ok, The packet is for PIPEX */
if (!rewind)
session->proto.l2tp.nr_gap += nseq;
@@ -3052,12 +2975,6 @@ pipex_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (ENOTDIR);
return (sysctl_int(oldp, oldlenp, newp, newlen,
&pipex_enable));
- case PIPEXCTL_INQ:
- return (sysctl_mq(name + 1, namelen - 1,
- oldp, oldlenp, newp, newlen, &pipexinq));
- case PIPEXCTL_OUTQ:
- return (sysctl_mq(name + 1, namelen - 1,
- oldp, oldlenp, newp, newlen, &pipexoutq));
default:
return (ENOPROTOOPT);
}
diff --git a/sys/net/pipex.h b/sys/net/pipex.h
index bba010b46aa..9ea4dd9bf7b 100644
--- a/sys/net/pipex.h
+++ b/sys/net/pipex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.h,v 1.26 2020/07/29 12:09:31 mvs Exp $ */
+/* $OpenBSD: pipex.h,v 1.27 2020/08/04 09:32:05 mvs Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -33,15 +33,11 @@
* Names for pipex sysctl objects
*/
#define PIPEXCTL_ENABLE 1
-#define PIPEXCTL_INQ 2
-#define PIPEXCTL_OUTQ 3
-#define PIPEXCTL_MAXID 4
+#define PIPEXCTL_MAXID 2
#define PIPEXCTL_NAMES { \
{ 0, 0 }, \
{ "enable", CTLTYPE_INT }, \
- { "inq", CTLTYPE_NODE }, \
- { "outq", CTLTYPE_NODE }, \
}
#define PIPEX_PROTO_L2TP 1 /* protocol L2TP */
diff --git a/sys/net/pipex_local.h b/sys/net/pipex_local.h
index 7dd181d1566..ba16d1818ff 100644
--- a/sys/net/pipex_local.h
+++ b/sys/net/pipex_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex_local.h,v 1.38 2020/07/29 12:09:31 mvs Exp $ */
+/* $OpenBSD: pipex_local.h,v 1.39 2020/08/04 09:32:05 mvs Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -403,7 +403,8 @@ void pipex_ip_input (struct mbuf *, struct pipex_session *);
#ifdef INET6
void pipex_ip6_input (struct mbuf *, struct pipex_session *);
#endif
-struct mbuf *pipex_common_input(struct pipex_session *, struct mbuf *, int, int, int);
+struct mbuf *pipex_common_input(struct pipex_session *,
+ struct mbuf *, int, int);
#ifdef PIPEX_PPPOE
void pipex_pppoe_output (struct mbuf *, struct pipex_session *);