ok yasuoka
On Mon, 11 Jul 2022 01:11:22 +0300
Vitaliy Makkoveev <[email protected]> wrote:
> 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 from
> kernel and pipex(4) man page.
>
> Now the `flags' member of 'pipex_session' structure became immutable.
>
> Index: share/man/man4/pipex.4
> ===================================================================
> RCS file: /cvs/src/share/man/man4/pipex.4,v
> retrieving revision 1.14
> diff -u -p -r1.14 pipex.4
> --- share/man/man4/pipex.4 2 Jan 2021 13:15:15 -0000 1.14
> +++ share/man/man4/pipex.4 10 Jul 2022 21:59:42 -0000
> @@ -179,18 +179,6 @@ See
> section for a description of the
> .Vt pipex_statistics
> structure.
> -.It Dv PIPEXCSESSION Fa "struct pipex_session_config_req *"
> -Change the configuration of the specified session.
> -The session and configuration are specified by a
> -.Vt pipex_session_config_req
> -structure, which has the following definition:
> -.Bd -literal
> -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 */
> -};
> -.Ed
> .It Dv PIPEXGSTAT Fa "struct pipex_session_stat_req *"
> Get statistics for the specified session.
> Specify the session using a
> Index: sys/net/pipex.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pipex.c,v
> retrieving revision 1.144
> diff -u -p -r1.144 pipex.c
> --- sys/net/pipex.c 10 Jul 2022 21:28:10 -0000 1.144
> +++ sys/net/pipex.c 10 Jul 2022 21:59:56 -0000
> @@ -173,11 +173,6 @@ pipex_ioctl(void *ownersc, u_long cmd, c
>
> 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
> 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_
> }
>
> 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
> /*
> * 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
>
> 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
>
> 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
> 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
> Index: sys/net/pipex.h
> ===================================================================
> RCS file: /cvs/src/sys/net/pipex.h,v
> retrieving revision 1.32
> diff -u -p -r1.32 pipex.h
> --- sys/net/pipex.h 26 Jun 2022 15:50:21 -0000 1.32
> +++ sys/net/pipex.h 10 Jul 2022 21:59:56 -0000
> @@ -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)
> Index: sys/net/pipex_local.h
> ===================================================================
> RCS file: /cvs/src/sys/net/pipex_local.h,v
> retrieving revision 1.47
> diff -u -p -r1.47 pipex_local.h
> --- sys/net/pipex_local.h 26 Jun 2022 15:50:21 -0000 1.47
> +++ sys/net/pipex_local.h 10 Jul 2022 21:59:57 -0000
> @@ -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_sessi
> 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 *,
>