git: 2fdf3ed1e330 - main - ng_netflow: Move various variables under INET || INET6.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Apr 2022 23:09:33 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2fdf3ed1e330c72eaf8beb745d4717e6c262b5f6 commit 2fdf3ed1e330c72eaf8beb745d4717e6c262b5f6 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-04-13 23:08:21 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-04-13 23:08:21 +0000 ng_netflow: Move various variables under INET || INET6. --- sys/netgraph/netflow/ng_netflow.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c index 187e18a3130e..ab0aff5cf7fc 100644 --- a/sys/netgraph/netflow/ng_netflow.c +++ b/sys/netgraph/netflow/ng_netflow.c @@ -594,11 +594,15 @@ ng_netflow_rcvdata (hook_p hook, item_p item) struct ip *ip = NULL; struct ip6_hdr *ip6 = NULL; struct m_tag *mtag; - int pullup_len = 0, off; - uint8_t acct = 0, bypass = 0, flags = 0, upper_proto = 0; + int pullup_len = 0; + uint8_t acct = 0, bypass = 0; int error = 0, l3_off = 0; +#if defined(INET) || defined(INET6) + int off; + uint8_t flags = 0, upper_proto = 0; unsigned int src_if_index; caddr_t upper_ptr = NULL; +#endif fib_export_p fe; uint32_t fib; @@ -655,8 +659,10 @@ ng_netflow_rcvdata (hook_p hook, item_p item) } } +#if defined(INET) || defined(INET6) /* Import configuration flags related to flow creation */ flags = iface->info.conf & NG_NETFLOW_FLOW_FLAGS; +#endif NGI_GET_M(item, m); m_old = m; @@ -775,7 +781,9 @@ ng_netflow_rcvdata (hook_p hook, item_p item) break; } +#if defined(INET) || defined(INET6) off = pullup_len; +#endif if ((ip != NULL) && ((ip->ip_off & htons(IP_OFFMASK)) == 0)) { if ((ip->ip_v != IPVERSION) || @@ -787,9 +795,11 @@ ng_netflow_rcvdata (hook_p hook, item_p item) */ M_CHECK((ip->ip_hl << 2) - sizeof(struct ip)); +#if defined(INET) || defined(INET6) /* Save upper layer offset and proto */ off = pullup_len; upper_proto = ip->ip_p; +#endif /* * XXX: in case of wrong upper layer header we will @@ -811,8 +821,10 @@ ng_netflow_rcvdata (hook_p hook, item_p item) * Nothing to save except upper layer proto, * since this is a packet fragment. */ +#if defined(INET) || defined(INET6) flags |= NG_NETFLOW_IS_FRAG; upper_proto = ip->ip_p; +#endif if ((ip->ip_v != IPVERSION) || ((ip->ip_hl << 2) < sizeof(struct ip))) goto bypass; @@ -914,6 +926,7 @@ loopend: ip6 = (struct ip6_hdr *)(mtod(m, caddr_t) + l3_off); } +#if defined(INET) || defined(INET6) upper_ptr = (caddr_t)(mtod(m, caddr_t) + off); /* Determine packet input interface. Prefer configured. */ @@ -923,6 +936,7 @@ loopend: src_if_index = m->m_pkthdr.rcvif->if_index; } else src_if_index = iface->info.ifinfo_index; +#endif /* Check packet FIB */ fib = M_GETFIB(m);