[ovs-dev] [bundle 4/5] ofputil: Export ofputil_check_output_port().

Ethan Jackson ethan at nicira.com
Fri Jul 15 20:50:03 UTC 2011


Future patches will use this function outside of the ofputil
module.
---
 lib/ofp-util.c |    7 ++++---
 lib/ofp-util.h |    1 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 00f9ce8..39bd0d1 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1944,8 +1944,8 @@ make_echo_reply(const struct ofp_header *rq)
 /* Checks that 'port' is a valid output port for the OFPAT_OUTPUT action, given
  * that the switch will never have more than 'max_ports' ports.  Returns 0 if
  * 'port' is valid, otherwise an ofp_mkerr() return code. */
-static int
-check_output_port(uint16_t port, int max_ports)
+int
+ofputil_check_output_port(uint16_t port, int max_ports)
 {
     switch (port) {
     case OFPP_IN_PORT:
@@ -1994,7 +1994,8 @@ validate_actions(const union ofp_action *actions, size_t n_actions,
         error = 0;
         switch ((enum ofputil_action_code) code) {
         case OFPUTIL_OFPAT_OUTPUT:
-            error = check_output_port(ntohs(a->output.port), max_ports);
+            error = ofputil_check_output_port(ntohs(a->output.port),
+                                              max_ports);
             break;
 
         case OFPUTIL_OFPAT_SET_VLAN_VID:
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 48b0a4c..adad087 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -92,6 +92,7 @@ int ofputil_decode_msg_type(const struct ofp_header *,
                             const struct ofputil_msg_type **);
 enum ofputil_msg_code ofputil_msg_type_code(const struct ofputil_msg_type *);
 const char *ofputil_msg_type_name(const struct ofputil_msg_type *);
+int ofputil_check_output_port(uint16_t ofp_port, int max_ports);
 
 /* Converting OFPFW_NW_SRC_MASK and OFPFW_NW_DST_MASK wildcard bit counts to
  * and from IP bitmasks. */
-- 
1.7.6




More information about the dev mailing list