summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-07-12 08:58:54 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2022-07-12 08:58:54 +0000
commitee4d8861d21f44576e882ac10ef186698e1ace7c (patch)
tree0eacccf20d5c3aa1265a6a212a397ea66cab3889 /sys/net
parentcdfdaead097054da7a8aec382a7c747859120bca (diff)
Remove PIPEXCSESSION pipex(4) ioctl(2) command from kernel and man page.
Long time ago pipex(4) session can't be deleted until both pipex(4) input and output queues become empty. Dead sessions were linked to the stack and the `ip_forward' flag was used to prevent packets forwarding. npppd(8) marked such sessions by doing PIPEXCSESSION ioctl(2) call. But since we started to unlink close session from the stack, this logic became unnecessary. Also pipex(4) session could be closed just after close request. npppd(8) was the only userland program which did PIPEXCSESSION ioctl(2) call, and we removed it week ago. It's time to remove the remains. Now the `flags' member of 'pipex_session' structure became immutable. ok yasuoka@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pipex.c48
-rw-r--r--sys/net/pipex.h9
-rw-r--r--sys/net/pipex_local.h13
3 files changed, 7 insertions, 63 deletions
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 2b43d9652a3..74c365745a1 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.c,v 1.144 2022/07/10 21:28:10 mvs Exp $ */
+/* $OpenBSD: pipex.c,v 1.145 2022/07/12 08:58:53 mvs Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -173,11 +173,6 @@ pipex_ioctl(void *ownersc, u_long cmd, caddr_t data)
NET_ASSERT_LOCKED();
switch (cmd) {
- case PIPEXCSESSION:
- ret = pipex_config_session(
- (struct pipex_session_config_req *)data, ownersc);
- break;
-
case PIPEXGSTAT:
ret = pipex_get_stat((struct pipex_session_stat_req *)data,
ownersc);
@@ -323,8 +318,6 @@ pipex_init_session(struct pipex_session **rsession,
session->ppp_flags = req->pr_ppp_flags;
session->ppp_id = req->pr_ppp_id;
- session->flags |= PIPEX_SFLAGS_IP_FORWARD;
-
session->stat_counters = counters_alloc(pxc_ncounters);
session->ip_address.sin_family = AF_INET;
@@ -569,32 +562,6 @@ pipex_export_session_stats(struct pipex_session *session,
}
Static int
-pipex_config_session(struct pipex_session_config_req *req, void *ownersc)
-{
- struct pipex_session *session;
- int error = 0;
-
- NET_ASSERT_LOCKED();
-
- session = pipex_lookup_by_session_id(req->pcr_protocol,
- req->pcr_session_id);
- if (session == NULL)
- return (EINVAL);
-
- if (session->ownersc == ownersc) {
- if (req->pcr_ip_forward != 0)
- session->flags |= PIPEX_SFLAGS_IP_FORWARD;
- else
- session->flags &= ~PIPEX_SFLAGS_IP_FORWARD;
- } else
- error = EINVAL;
-
- pipex_rele_session(session);
-
- return error;
-}
-
-Static int
pipex_get_stat(struct pipex_session_stat_req *req, void *ownersc)
{
struct pipex_session *session;
@@ -810,9 +777,7 @@ pipex_ip_output(struct mbuf *m0, struct pipex_session *session)
/*
* Multicast packet is a idle packet and it's not TCP.
*/
- if ((session->flags & (PIPEX_SFLAGS_IP_FORWARD |
- PIPEX_SFLAGS_IP6_FORWARD)) == 0)
- goto drop;
+
/* reset idle timer */
if (session->timeout_sec != 0) {
is_idle = 0;
@@ -850,9 +815,6 @@ pipex_ip_output(struct mbuf *m0, struct pipex_session *session)
if (session_tmp->ownersc != session->ownersc)
goto next;
- if ((session->flags & (PIPEX_SFLAGS_IP_FORWARD |
- PIPEX_SFLAGS_IP6_FORWARD)) == 0)
- goto next;
refcnt_take(&session_tmp->pxs_refcnt);
mtx_leave(&pipex_list_mtx);
@@ -878,8 +840,6 @@ next:
}
return;
-drop:
- m_freem(m0);
dropped:
counters_inc(session->stat_counters, pxc_oerrors);
}
@@ -989,8 +949,6 @@ pipex_ppp_input(struct mbuf *m0, struct pipex_session *session, int decrypted)
switch (proto) {
case PPP_IP:
- if ((session->flags & PIPEX_SFLAGS_IP_FORWARD) == 0)
- goto drop;
if (!decrypted && pipex_session_is_mppe_required(session))
/*
* if ip packet received when mppe
@@ -1001,8 +959,6 @@ pipex_ppp_input(struct mbuf *m0, struct pipex_session *session, int decrypted)
return;
#ifdef INET6
case PPP_IPV6:
- if ((session->flags & PIPEX_SFLAGS_IP6_FORWARD) == 0)
- goto drop;
if (!decrypted && pipex_session_is_mppe_required(session))
/*
* if ip packet received when mppe
diff --git a/sys/net/pipex.h b/sys/net/pipex.h
index 1f15f6bf8c9..4fbb56ff77f 100644
--- a/sys/net/pipex.h
+++ b/sys/net/pipex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex.h,v 1.32 2022/06/26 15:50:21 mvs Exp $ */
+/* $OpenBSD: pipex.h,v 1.33 2022/07/12 08:58:53 mvs Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -145,12 +145,6 @@ struct pipex_session_list_req {
int plr_ppp_id[PIPEX_MAX_LISTREQ]; /* PPP id */
};
-struct pipex_session_config_req {
- int pcr_protocol; /* tunnel protocol */
- uint16_t pcr_session_id; /* session-id */
- int pcr_ip_forward; /* ip_forwarding on/off */
-};
-
/* for pppx(4) */
struct pppx_hdr {
u_int32_t pppx_proto; /* write: protocol in PIPEX_PROTO_ */
@@ -167,7 +161,6 @@ struct pipex_session_descr_req {
/* PIPEX ioctls */
#define PIPEXASESSION _IOW ('p', 3, struct pipex_session_req)
#define PIPEXDSESSION _IOWR('p', 4, struct pipex_session_close_req)
-#define PIPEXCSESSION _IOW ('p', 5, struct pipex_session_config_req)
#define PIPEXGSTAT _IOWR('p', 6, struct pipex_session_stat_req)
#define PIPEXGCLOSED _IOR ('p', 7, struct pipex_session_list_req)
#define PIPEXSIFDESCR _IOW ('p', 8, struct pipex_session_descr_req)
diff --git a/sys/net/pipex_local.h b/sys/net/pipex_local.h
index 8959e21759d..3815c5c24d2 100644
--- a/sys/net/pipex_local.h
+++ b/sys/net/pipex_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex_local.h,v 1.47 2022/06/26 15:50:21 mvs Exp $ */
+/* $OpenBSD: pipex_local.h,v 1.48 2022/07/12 08:58:53 mvs Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -180,12 +180,9 @@ struct pipex_session {
uint32_t idle_time; /* [L] idle time in seconds */
- u_int flags; /* [N] flags, see below */
-#define PIPEX_SFLAGS_IP_FORWARD 0x01 /* [N] enable IP forwarding */
-#define PIPEX_SFLAGS_IP6_FORWARD 0x02 /* [N] enable IPv6 forwarding */
-#define PIPEX_SFLAGS_MULTICAST 0x04 /* [I] virtual entry for
- multicast */
-#define PIPEX_SFLAGS_PPPX 0x08 /* [I] interface is
+ u_int flags; /* [I] flags, see below */
+#define PIPEX_SFLAGS_MULTICAST 0x01 /* virtual entry for multicast */
+#define PIPEX_SFLAGS_PPPX 0x02 /* interface is
point2point(pppx) */
uint16_t protocol; /* [I] tunnel protocol (PK) */
@@ -415,8 +412,6 @@ void pipex_unlink_session(struct pipex_session *);
void pipex_unlink_session_locked(struct pipex_session *);
void pipex_export_session_stats(struct pipex_session *,
struct pipex_statistics *);
-int pipex_config_session (struct pipex_session_config_req *,
- void *);
int pipex_get_stat (struct pipex_session_stat_req *,
void *);
int pipex_get_closed (struct pipex_session_list_req *,