This makes it possible for the upcoming ovn-northd-ddlog program to call into it from Rust.
Signed-off-by: Ben Pfaff <b...@ovn.org> --- lib/automake.mk | 1 + lib/ovn-l7.c | 39 +++++++++++++++++++++++++++++++++++++++ lib/ovn-l7.h | 19 +------------------ 3 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 lib/ovn-l7.c diff --git a/lib/automake.mk b/lib/automake.mk index f3e9c8818b2b..d38d5c50c768 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -19,6 +19,7 @@ lib_libovn_la_SOURCES = \ lib/mcast-group-index.h \ lib/lex.c \ lib/ovn-l7.h \ + lib/ovn-l7.c \ lib/ovn-util.c \ lib/ovn-util.h \ lib/logical-fields.c \ diff --git a/lib/ovn-l7.c b/lib/ovn-l7.c new file mode 100644 index 000000000000..3a5f3f3ec02e --- /dev/null +++ b/lib/ovn-l7.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Red Hat. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <config.h> + +#include "ovn-l7.h" + +bool +ipv6_addr_is_routable_multicast(const struct in6_addr *ip) +{ + if (!ipv6_addr_is_multicast(ip)) { + return false; + } + + /* Check multicast group scope, RFC 4291, 2.7. */ + switch (ip->s6_addr[1] & 0x0F) { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + case 0x0F: + return false; + default: + return true; + } +} diff --git a/lib/ovn-l7.h b/lib/ovn-l7.h index c3e8fd660983..a3bfd4e539e3 100644 --- a/lib/ovn-l7.h +++ b/lib/ovn-l7.h @@ -420,24 +420,7 @@ controller_event_opts_destroy(struct controller_event_options *opts) } } -static inline bool -ipv6_addr_is_routable_multicast(const struct in6_addr *ip) { - if (!ipv6_addr_is_multicast(ip)) { - return false; - } - - /* Check multicast group scope, RFC 4291, 2.7. */ - switch (ip->s6_addr[1] & 0x0F) { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x0F: - return false; - default: - return true; - } -} +bool ipv6_addr_is_routable_multicast(const struct in6_addr *); static inline bool ipv6_addr_is_host_zero(const struct in6_addr *prefix, -- 2.26.2 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev