summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-09-18 14:38:28 +0000
committerglebius <glebius@FreeBSD.org>2014-09-18 14:38:28 +0000
commit0917a065ca1381c4aa57563ea3ebf5092d237a14 (patch)
tree65a3d1bad235bfc0a0582ebf2881053fb6f36e46 /sys/netgraph
parentcc4139ffebe82bc65f885722c3019ff63bfb7e33 (diff)
downloadFreeBSD-src-0917a065ca1381c4aa57563ea3ebf5092d237a14.zip
FreeBSD-src-0917a065ca1381c4aa57563ea3ebf5092d237a14.tar.gz
Add a function to set if_get_counter method for an ifnet. To be used
in the drivers that are already converted to "Juniper drvapi". This can be revisited in future.
Diffstat (limited to 'sys/netgraph')
-rw-r--r--sys/netgraph/ng_ppp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c
index 9db1a2f..89ab617 100644
--- a/sys/netgraph/ng_ppp.c
+++ b/sys/netgraph/ng_ppp.c
@@ -237,6 +237,7 @@ static ng_rcvdata_t ng_ppp_rcvdata;
static ng_disconnect_t ng_ppp_disconnect;
static ng_rcvdata_t ng_ppp_rcvdata_inet;
+static ng_rcvdata_t ng_ppp_rcvdata_inet_fast;
static ng_rcvdata_t ng_ppp_rcvdata_ipv6;
static ng_rcvdata_t ng_ppp_rcvdata_ipx;
static ng_rcvdata_t ng_ppp_rcvdata_atalk;
@@ -793,6 +794,19 @@ ng_ppp_rcvdata_inet(hook_p hook, item_p item)
}
/*
+ * Receive data on a hook inet and pass it directly to first link.
+ */
+static int
+ng_ppp_rcvdata_inet_fast(hook_p hook, item_p item)
+{
+ const node_p node = NG_HOOK_NODE(hook);
+ const priv_p priv = NG_NODE_PRIVATE(node);
+
+ return (ng_ppp_link_xmit(node, item, PROT_IP, priv->activeLinks[0],
+ NGI_M(item)->m_pkthdr.len));
+}
+
+/*
* Receive data on a hook ipv6.
*/
static int
@@ -2530,6 +2544,20 @@ ng_ppp_update(node_p node, int newConf)
link->seq = MP_NOSEQ;
}
}
+
+ if (priv->hooks[HOOK_INDEX_INET] != NULL) {
+ if (priv->conf.enableIP == 1 &&
+ priv->numActiveLinks == 1 &&
+ priv->conf.enableMultilink == 0 &&
+ priv->conf.enableCompression == 0 &&
+ priv->conf.enableEncryption == 0 &&
+ priv->conf.enableVJCompression == 0)
+ NG_HOOK_SET_RCVDATA(priv->hooks[HOOK_INDEX_INET],
+ ng_ppp_rcvdata_inet_fast);
+ else
+ NG_HOOK_SET_RCVDATA(priv->hooks[HOOK_INDEX_INET],
+ ng_ppp_rcvdata_inet);
+ }
}
/*
OpenPOWER on IntegriCloud