MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_ppp_proto_recv

Function ng_ppp_proto_recv

freebsd/netgraph/ng_ppp.c:919–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

917}
918
919static int
920ng_ppp_proto_recv(node_p node, item_p item, uint16_t proto, uint16_t linkNum)
921{
922 const priv_p priv = NG_NODE_PRIVATE(node);
923 hook_p outHook = NULL;
924 int error;
925#ifdef ALIGNED_POINTER
926 struct mbuf *m, *n;
927
928 NGI_GET_M(item, m);
929 if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) {
930 n = m_defrag(m, M_NOWAIT);
931 if (n == NULL) {
932 m_freem(m);
933 NG_FREE_ITEM(item);
934 return (ENOBUFS);
935 }
936 m = n;
937 }
938 NGI_M(item) = m;
939#endif /* ALIGNED_POINTER */
940 switch (proto) {
941 case PROT_IP:
942 if (priv->conf.enableIP)
943 outHook = priv->hooks[HOOK_INDEX_INET];
944 break;
945 case PROT_IPV6:
946 if (priv->conf.enableIPv6)
947 outHook = priv->hooks[HOOK_INDEX_IPV6];
948 break;
949 case PROT_ATALK:
950 if (priv->conf.enableAtalk)
951 outHook = priv->hooks[HOOK_INDEX_ATALK];
952 break;
953 case PROT_IPX:
954 if (priv->conf.enableIPX)
955 outHook = priv->hooks[HOOK_INDEX_IPX];
956 break;
957 }
958
959 if (outHook == NULL)
960 return (ng_ppp_bypass(node, item, proto, linkNum));
961
962 /* Send packet out hook. */
963 NG_FWD_ITEM_HOOK(error, item, outHook);
964 return (error);
965}
966
967/*
968 * Header compression layer

Callers 2

ng_ppp_hcomp_recvFunction · 0.85
ng_ppp_rcvdata_vjc_ipFunction · 0.85

Calls 3

m_defragFunction · 0.85
ng_ppp_bypassFunction · 0.85
m_freemFunction · 0.50

Tested by

no test coverage detected