From 015873ec6c3c1a440c32d9d0b7938129228871b3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 4 May 2009 16:14:35 -0700 Subject: [PATCH] secchan: Reinstall flows deleted externally. If something external to secchan deletes flows from the datapath (e.g. the administrator runs "dpctl dp-del-flows") then until now secchan would switch all of those packets manually, using dpif_execute(). Better behavior is to reinstall the flow. This commit implements that. --- secchan/ofproto.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/secchan/ofproto.c b/secchan/ofproto.c index c5b443e8..7faa0d8c 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -1581,6 +1581,17 @@ rule_install(struct ofproto *p, struct rule *rule, struct rule *displaced_rule) } } +static void +rule_reinstall(struct ofproto *ofproto, struct rule *rule) +{ + if (rule->installed) { + struct odp_flow_put put; + do_put_flow(ofproto, rule, ODPPF_CREATE | ODPPF_MODIFY, &put); + } else { + rule_install(ofproto, rule, NULL); + } +} + static void rule_update_actions(struct ofproto *ofproto, struct rule *rule) { @@ -2928,16 +2939,8 @@ handle_odp_msg(struct ofproto *p, struct ofpbuf *packet) } } - /* Invariant: 'rule' is an exact-match rule. */ - - /* XXX should forcibly install the rule here, since it's possible that it - * got deleted externally (e.g. "dpctl dp-del-flows") and unless we - * re-install it here we'll end up processing every packet by hand. But - * the datapath doesn't provide a good interface for that. */ - rule_install(p, rule, NULL); - - /* Execute rule on packet. */ rule_execute(p, rule, &payload, &flow); + rule_reinstall(p, rule); ofpbuf_delete(packet); } -- 2.30.2