diff options
author | Rafael Zalamena <rzalamena@cvs.openbsd.org> | 2016-10-12 09:50:56 +0000 |
---|---|---|
committer | Rafael Zalamena <rzalamena@cvs.openbsd.org> | 2016-10-12 09:50:56 +0000 |
commit | 46ccd072e755388617368895c4909a44311b9ce3 (patch) | |
tree | 533c064bcbbbde6ef01ab0a03110993481b24660 /sys/net | |
parent | f5aa42d87c81dd50da04174004e06f096b51bbc1 (diff) |
When sending a action_output for a table-miss to the controller the
reason is always NO_MATCH. This fixes the compatibility with switchd(8)
which already works with other switches.
input from goda@
ok reyk@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/switchofp.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c index a2e2fad840e..cb5b161d705 100644 --- a/sys/net/switchofp.c +++ b/sys/net/switchofp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchofp.c,v 1.12 2016/10/11 16:37:11 rzalamena Exp $ */ +/* $OpenBSD: switchofp.c,v 1.13 2016/10/12 09:50:55 rzalamena Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -85,6 +85,7 @@ struct swofp_flow_entry { uint16_t swfe_hard_timeout; uint16_t swfe_flags; uint32_t swfe_id; /* internal used */ + int swfe_tablemiss; }; struct swofp_flow_table { @@ -125,6 +126,7 @@ struct swofp_pipline_desc { struct switch_fwdp_queue swpld_fwdp_q; struct swofp_action_set swpld_action_set[SWOFP_ACTION_SET_MAX]; struct ofp_action_header *swpld_set_fields[OFP_XM_T_MAX]; + int swpld_tablemiss; }; struct swofp_ofs { @@ -3153,7 +3155,8 @@ swofp_action_output(struct switch_softc *sc, struct mbuf *m, switch (ntohl(oao->ao_port)) { case OFP_PORT_CONTROLLER: swofp_action_output_controller(sc, mc, swpld, - ntohs(oao->ao_max_len), OFP_PKTIN_REASON_ACTION); + ntohs(oao->ao_max_len), swpld->swpld_tablemiss ? + OFP_PKTIN_REASON_NO_MATCH : OFP_PKTIN_REASON_ACTION); break; case OFP_PORT_FLOWTABLE: swofp_forward_ofs(sc, swpld->swpld_swfcl, mc); @@ -4228,6 +4231,7 @@ swofp_forward_ofs(struct switch_softc *sc, struct switch_flow_classify *swfcl, /* Set pipeline parameters */ swpld->swpld_cookie = swfe->swfe_cookie; swpld->swpld_table_id = swft->swft_table_id; + swpld->swpld_tablemiss = swfe->swfe_tablemiss; /* Update statistics */ nanouptime(&swfe->swfe_idle_time); @@ -4689,6 +4693,14 @@ swofp_flow_mod_cmd_add(struct switch_softc *sc, struct mbuf *m) } memcpy(swfe->swfe_match, om, ntohs(om->om_length)); + /* + * If the ofp_match structure is empty and priority is zero, then + * this is a special flow type called table-miss which is the last + * flow to match. + */ + if (ntohs(om->om_length) == sizeof(*om) && swfe->swfe_priority == 0) + swfe->swfe_tablemiss = 1; + if ((error = swofp_flow_entry_put_instructions(&m, swfe))) goto ofp_error_free_flow; |