Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140146344
D6543.id16817.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D6543.id16817.diff
View Options
Index: sys/netgraph/netflow/netflow.c
===================================================================
--- sys/netgraph/netflow/netflow.c
+++ sys/netgraph/netflow/netflow.c
@@ -34,6 +34,7 @@
#include "opt_inet6.h"
#include "opt_route.h"
#include <sys/param.h>
+#include <sys/bitstring.h>
#include <sys/systm.h>
#include <sys/counter.h>
#include <sys/kernel.h>
@@ -147,6 +148,17 @@
r->dst.r_dst6.__u6_addr.__u6_addr32[3]);
}
}
+
+static inline int
+ip6_masklen(struct sockaddr_in6 *mask, struct rt_addrinfo *info)
+{
+ int len;
+
+ len = 128;
+ if (info->rti_addrs & RTA_NETMASK)
+ bit_count((bitstr_t *)&mask->sin6_addr, 0, len, &len);
+ return (len);
+}
#endif
/*
@@ -399,11 +411,6 @@
}
#ifdef INET6
-/* XXX: make normal function, instead of.. */
-#define ipv6_masklen(x) bitcount32((x).__u6_addr.__u6_addr32[0]) + \
- bitcount32((x).__u6_addr.__u6_addr32[1]) + \
- bitcount32((x).__u6_addr.__u6_addr32[2]) + \
- bitcount32((x).__u6_addr.__u6_addr32[3])
static int
hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r,
int plen, uint8_t flags, uint8_t tcp_flags)
@@ -460,11 +467,7 @@
fle6->f.n.next_hop6 =
((struct sockaddr_in6 *)&rt_gateway)->sin6_addr;
- if (info.rti_addrs & RTA_NETMASK)
- fle6->f.dst_mask =
- ipv6_masklen(sin6_mask.sin6_addr);
- else
- fle6->f.dst_mask = 128;
+ fle6->f.dst_mask = ip6_masklen(&sin6_mask, &info);
rib_free_info(&info);
}
@@ -483,13 +486,8 @@
info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&sin6_mask;
if (rib_lookup_info(r->fib, (struct sockaddr *)&sin6, 0, 0,
- &info) == 0) {
- if (info.rti_addrs & RTA_NETMASK)
- fle6->f.src_mask =
- ipv6_masklen(sin6_mask.sin6_addr);
- else
- fle6->f.src_mask = 128;
- }
+ &info) == 0)
+ fle6->f.src_mask = ip6_masklen(&sin6_mask, &info);
}
/* Push new flow at the and of hash. */
@@ -497,7 +495,6 @@
return (0);
}
-#undef ipv6_masklen
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 8:20 PM (16 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27120968
Default Alt Text
D6543.id16817.diff (1 KB)
Attached To
Mode
D6543: Optimize hash6_insert() in sys/netgraph/netflow/netflow.c on 64-bit platforms
Attached
Detach File
Event Timeline
Log In to Comment