mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 22:35:15 +00:00
flow: New function is_nd().
This simplifies a few pieces of code and will acquire another user in an upcoming commit. Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
21
lib/flow.h
21
lib/flow.h
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -856,6 +857,26 @@ static inline bool is_icmpv6(const struct flow *flow,
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_nd(const struct flow *flow,
|
||||
struct flow_wildcards *wc)
|
||||
{
|
||||
if (is_icmpv6(flow, wc)) {
|
||||
if (wc) {
|
||||
memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
|
||||
}
|
||||
if (flow->tp_dst != htons(0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (wc) {
|
||||
memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
|
||||
}
|
||||
return (flow->tp_src == htons(ND_NEIGHBOR_SOLICIT) ||
|
||||
flow->tp_src == htons(ND_NEIGHBOR_ADVERT));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool is_igmp(const struct flow *flow, struct flow_wildcards *wc)
|
||||
{
|
||||
if (flow->dl_type == htons(ETH_TYPE_IP)) {
|
||||
|
Reference in New Issue
Block a user