Skip to content

Commit

Permalink
ofputil: Export ofputil_check_output_port().
Browse files Browse the repository at this point in the history
Future patches will use this function outside of the ofputil
module.
  • Loading branch information
ejj committed Jul 19, 2011
1 parent 015e08b commit 7741013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions lib/ofp-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 7741013

Please sign in to comment.