From 82b1a9c13d3d5f354661cbfe0de226b7cea99b7d Mon Sep 17 00:00:00 2001 From: Nuno Antunes Date: Sat, 18 Sep 2010 00:15:42 +0100 Subject: [PATCH] netgraph7: Welcome ng_ppp. --- etc/mtree/BSD.include.dist | 2 ++ include/Makefile | 1 + lib/libnetgraph7/debug.c | 2 ++ sys/conf/files | 2 +- sys/netgraph7/Makefile | 2 +- sys/netgraph7/ppp/Makefile | 8 ++++++++ sys/netgraph7/{ => ppp}/ng_ppp.c | 22 +++++++++++++--------- sys/netgraph7/{ => ppp}/ng_ppp.h | 0 8 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 sys/netgraph7/ppp/Makefile rename sys/netgraph7/{ => ppp}/ng_ppp.c (99%) rename sys/netgraph7/{ => ppp}/ng_ppp.h (100%) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 42687de197..caf9810dbb 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -238,6 +238,8 @@ .. lmi .. + ppp + .. pptpgre .. socket diff --git a/include/Makefile b/include/Makefile index cd72e920d8..2d3d64ce22 100644 --- a/include/Makefile +++ b/include/Makefile @@ -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 \ diff --git a/lib/libnetgraph7/debug.c b/lib/libnetgraph7/debug.c index 73782eab53..baa035cc61 100644 --- a/lib/libnetgraph7/debug.c +++ b/lib/libnetgraph7/debug.c @@ -87,7 +87,9 @@ /* #include #include +*/ #include +/* #include */ #include diff --git a/sys/conf/files b/sys/conf/files index 23e95a735e..7b60ed866c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -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 diff --git a/sys/netgraph7/Makefile b/sys/netgraph7/Makefile index e550ddbf46..ebd68b8297 100644 --- a/sys/netgraph7/Makefile +++ b/sys/netgraph7/Makefile @@ -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 index 0000000000..4bdbf4758f --- /dev/null +++ b/sys/netgraph7/ppp/Makefile @@ -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 diff --git a/sys/netgraph7/ng_ppp.c b/sys/netgraph7/ppp/ng_ppp.c similarity index 99% rename from sys/netgraph7/ng_ppp.c rename to sys/netgraph7/ppp/ng_ppp.c index ffb40343d9..cb0e241c49 100644 --- a/sys/netgraph7/ng_ppp.c +++ b/sys/netgraph7/ppp/ng_ppp.c @@ -101,11 +101,11 @@ #include #include -#include "ng_message.h" -#include "netgraph.h" -#include "ng_parse.h" +#include +#include +#include #include "ng_ppp.h" -#include "ng_vjc.h" +#include #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]); } /* diff --git a/sys/netgraph7/ng_ppp.h b/sys/netgraph7/ppp/ng_ppp.h similarity index 100% rename from sys/netgraph7/ng_ppp.h rename to sys/netgraph7/ppp/ng_ppp.h -- 2.41.0