netgraph7: Welcome ng_ppp.
authorNuno Antunes <nuno.antunes@gmail.com>
Fri, 17 Sep 2010 23:15:42 +0000 (00:15 +0100)
committerNuno Antunes <nuno.antunes@gmail.com>
Tue, 10 Jan 2012 14:10:31 +0000 (14:10 +0000)
etc/mtree/BSD.include.dist
include/Makefile
lib/libnetgraph7/debug.c
sys/conf/files
sys/netgraph7/Makefile
sys/netgraph7/ppp/Makefile [new file with mode: 0644]
sys/netgraph7/ppp/ng_ppp.c [moved from sys/netgraph7/ng_ppp.c with 99% similarity]
sys/netgraph7/ppp/ng_ppp.h [moved from sys/netgraph7/ng_ppp.h with 100% similarity]

index 42687de..caf9810 100644 (file)
         ..
         lmi
         ..
+        ppp
+        ..
         pptpgre
         ..
         socket
index cd72e92..2d3d64c 100644 (file)
@@ -71,6 +71,7 @@ LSUBDIRS=     bus/cam bus/cam/scsi \
        netgraph7/bridge netgraph7/cisco netgraph7/deflate netgraph7/echo \
        netgraph7/etf netgraph7/ether netgraph7/frame_relay netgraph7/hole \
        netgraph7/iface netgraph7/ksocket netgraph7/l2tp netgraph7/lmi \
+       netgraph7/ppp \
        netgraph7/pptpgre netgraph7/socket netgraph7/tee netgraph7/vjc \
        bus/cam bus/usb bus/pccard bus/pci bus/isa bus/ppbus bus/smbus \
        netproto/atm netproto/ipsec netproto/ipx \
index 73782ea..baa035c 100644 (file)
@@ -87,7 +87,9 @@
 /*
 #include <netgraph7/mppc/ng_mppc.h>
 #include <netgraph7/one2many/ng_one2many.h>
+*/
 #include <netgraph7/ppp/ng_ppp.h>
+/*
 #include <netgraph7/pppoe/ng_pppoe.h>
 */
 #include <netgraph7/pptpgre/ng_pptpgre.h>
index 23e95a7..7b60ed8 100644 (file)
@@ -1330,7 +1330,7 @@ netgraph7/ng_mppc.c               optional netgraph7_mppc_encryption
 netgraph7/ng_nat.c             optional netgraph7_nat
 netgraph7/ng_one2many.c                optional netgraph7_one2many
 netgraph7/netgraph/ng_parse.c  optional netgraph7
-netgraph7/ng_ppp.c             optional netgraph7_ppp
+netgraph7/ppp/ng_ppp.c         optional netgraph7_ppp
 netgraph7/ng_pppoe.c           optional netgraph7_pppoe
 netgraph7/pptpgre/ng_pptpgre.c optional netgraph7_pptpgre
 netgraph7/ng_pred1.c           optional netgraph7_pred1
index e550ddb..ebd68b8 100644 (file)
@@ -19,6 +19,7 @@ SUBDIR=       UI \
        l2tp \
        lmi \
        netgraph \
+       ppp \
        pptpgre \
        socket \
        tee \
@@ -27,7 +28,6 @@ SUBDIR=       UI \
 #      fec \
 #      netgraph \
 #      one2many \
-#      ppp \
 #      pppoe \
 #      rfc1490 \
 #      socket \
diff --git a/sys/netgraph7/ppp/Makefile b/sys/netgraph7/ppp/Makefile
new file mode 100644 (file)
index 0000000..4bdbf47
--- /dev/null
@@ -0,0 +1,8 @@
+# $FreeBSD: src/sys/modules/netgraph/ppp/Makefile,v 1.1.4.3 2001/12/21 09:00:49 ru Exp $
+# $DragonFly: src/sys/netgraph/ppp/Makefile,v 1.2 2003/06/17 04:28:46 dillon Exp $
+# $Whistle: Makefile,v 1.1 1999/01/24 02:52:12 archie Exp $
+
+KMOD=          ng_ppp
+SRCS=          ng_ppp.c
+
+.include <bsd.kmod.mk>
similarity index 99%
rename from sys/netgraph7/ng_ppp.c
rename to sys/netgraph7/ppp/ng_ppp.c
index ffb4034..cb0e241 100644 (file)
 #include <sys/errno.h>
 #include <sys/ctype.h>
 
-#include "ng_message.h"
-#include "netgraph.h"
-#include "ng_parse.h"
+#include <netgraph7/ng_message.h>
+#include <netgraph7/netgraph.h>
+#include <netgraph7/ng_parse.h>
 #include "ng_ppp.h"
-#include "ng_vjc.h"
+#include <netgraph7/vjc/ng_vjc.h>
 
 #ifdef NG_SEPARATE_MALLOC
 MALLOC_DEFINE(M_NETGRAPH_PPP, "netgraph_ppp", "netgraph ppp node");
@@ -320,7 +320,7 @@ static void ng_ppp_frag_timeout(node_p node, hook_p hook, void *arg1,
 static void    ng_ppp_frag_checkstale(node_p node);
 static void    ng_ppp_frag_reset(node_p node);
 static void    ng_ppp_mp_strategy(node_p node, int len, int *distrib);
-static int     ng_ppp_intcmp(void *latency, const void *v1, const void *v2);
+static int     ng_ppp_intcmp(const void *v1, const void *v2);
 static struct mbuf *ng_ppp_addproto(struct mbuf *m, uint16_t proto, int compOK);
 static struct mbuf *ng_ppp_cutproto(struct mbuf *m, uint16_t *proto);
 static struct mbuf *ng_ppp_prepend(struct mbuf *m, const void *buf, int len);
@@ -469,6 +469,8 @@ static struct ng_type ng_ppp_typestruct = {
 };
 NETGRAPH_INIT(ppp, &ng_ppp_typestruct);
 
+static int *compareLatencies;                  /* hack for ng_ppp_intcmp() */
+
 /* Address and control field header */
 static const uint8_t ng_ppp_acf[2] = { 0xff, 0x03 };
 
@@ -2287,8 +2289,10 @@ ng_ppp_mp_strategy(node_p node, int len, int *distrib)
        }
 
        /* Sort active links by latency */
-       qsort_r(sortByLatency,
-           priv->numActiveLinks, sizeof(*sortByLatency), latency, ng_ppp_intcmp);
+       compareLatencies = latency;
+       kqsort(sortByLatency,
+           priv->numActiveLinks, sizeof(*sortByLatency), ng_ppp_intcmp);
+       compareLatencies = NULL;
 
        /* Find the interval we need (add links in sortByLatency[] order) */
        for (numFragments = 1;
@@ -2373,12 +2377,12 @@ ng_ppp_mp_strategy(node_p node, int len, int *distrib)
  * Compare two integers
  */
 static int
-ng_ppp_intcmp(void *latency, const void *v1, const void *v2)
+ng_ppp_intcmp(const void *v1, const void *v2)
 {
        const int index1 = *((const int *) v1);
        const int index2 = *((const int *) v2);
 
-       return ((int *)latency)[index1] - ((int *)latency)[index2];
+       return (compareLatencies[index1] - compareLatencies[index2]);
 }
 
 /*