Add minimal support for integration with pipex(4). Initialize interface
structure, pass IOCTLs to pipex(4) specific handler, etc.

Acceleration is working only in the DL path only at the moment.

Modification is not ready for applying. Work still in process.
---
 sys/net/if_ppp.c    | 16 ++++++++++++++++
 sys/net/if_pppvar.h |  4 ++++
 sys/net/ppp_tty.c   | 17 +++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git sys/net/if_ppp.c sys/net/if_ppp.c
index 3f03d18b6ab..482eef37732 100644
--- sys/net/if_ppp.c
+++ sys/net/if_ppp.c
@@ -129,6 +129,10 @@
 #include <netinet/in.h>
 #include <netinet/ip.h>
 
+#ifdef PIPEX
+#include <net/pipex.h>
+#endif
+
 #include "bpfilter.h"
 
 #ifdef VJC
@@ -198,6 +202,9 @@ pppattach(void)
 {
        LIST_INIT(&ppp_softc_list);
        if_clone_attach(&ppp_cloner);
+#ifdef PIPEX
+       pipex_init();
+#endif
 }
 
 int
@@ -228,6 +235,11 @@ ppp_clone_create(struct if_clone *ifc, int unit)
 #if NBPFILTER > 0
        bpfattach(&ifp->if_bpf, ifp, DLT_PPP, PPP_HDRLEN);
 #endif
+
+#ifdef PIPEX
+       pipex_iface_init(&sc->sc_pipex_iface, &sc->sc_if);
+#endif
+
        NET_LOCK();
        LIST_INSERT_HEAD(&ppp_softc_list, sc, sc_list);
        NET_UNLOCK();
@@ -247,6 +259,10 @@ ppp_clone_destroy(struct ifnet *ifp)
        LIST_REMOVE(sc, sc_list);
        NET_UNLOCK();
 
+#ifdef PIPEX
+       pipex_iface_fini(&sc->sc_pipex_iface);
+#endif
+
        if_detach(ifp);
 
        free(sc, M_DEVBUF, 0);
diff --git sys/net/if_pppvar.h sys/net/if_pppvar.h
index 1c4dd9977b5..57f3b76c4f6 100644
--- sys/net/if_pppvar.h
+++ sys/net/if_pppvar.h
@@ -139,6 +139,10 @@ struct ppp_softc {
        u_char  sc_rawin[16];           /* chars as received */
        int     sc_rawin_count;         /* # in sc_rawin */
        LIST_ENTRY(ppp_softc) sc_list;  /* all ppp interfaces */
+
+#ifdef PIPEX
+       struct pipex_iface_context sc_pipex_iface;      /* pipex context */
+#endif
 };
 
 #ifdef _KERNEL
diff --git sys/net/ppp_tty.c sys/net/ppp_tty.c
index 124b9df59ac..93bcd62ae4b 100644
--- sys/net/ppp_tty.c
+++ sys/net/ppp_tty.c
@@ -122,6 +122,10 @@
 #include <net/slcompress.h>
 #endif
 
+#ifdef PIPEX
+#include <net/pipex.h>
+#endif
+
 #include <net/bpf.h>
 #include <net/ppp_defs.h>
 #include <net/if_ppp.h>
@@ -425,6 +429,19 @@ ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int 
flag, struct proc *p)
        bcopy(sc->sc_asyncmap, data, sizeof(sc->sc_asyncmap));
        break;
 
+#ifdef PIPEX
+    case PIPEXSMODE:
+    case PIPEXGMODE:
+    case PIPEXASESSION:
+    case PIPEXDSESSION:
+    case PIPEXCSESSION:
+    case PIPEXGSTAT:
+       if ((error = suser(p)) != 0)
+           break;
+       error = pipex_ioctl(&sc->sc_pipex_iface, cmd, data);
+       break;
+#endif
+
     default:
        NET_LOCK();
        error = pppioctl(sc, cmd, data, flag, p);
-- 
2.26.0

Reply via email to