Some more comments: (snip)
>> +} >> + >> +static void >> +tnl_port_unref(struct cls_rule *cr) >> +{ >> + if (cr) { >> + struct tunnel_ports *p; >> + >> + p = tnl_port_cast(cr); >> + if (ovs_refcount_unref_relaxed(&p->ref_cnt) == 1) { >> + classifier_remove(&cls, cr); You must also free the resources with ovsrcu_postpone() here: - must call cls_rule_destroy(cr) - must free the tunnel port >> + } >> + } >> +} >> + (snip) >> + >> +static void >> +tnl_route_del(struct unixctl_conn *conn, int argc OVS_UNUSED, >> + const char *argv[], void *aux OVS_UNUSED) >> +{ >> + struct cls_rule *cr; >> + struct flow flow; >> + ovs_be32 ip, mask; >> + >> + inet_aton(argv[1], (struct in_addr *)&ip); >> + inet_aton(argv[2], (struct in_addr *)&mask); >> + >> + ovs_mutex_lock(&mutex); >> + memset(&flow, 0, sizeof(flow)); >> + flow.nw_dst = ip & mask; >> + >> + cr = classifier_lookup(&cls, &flow, NULL); >> + if (cr) { >> + classifier_remove(&cls, cr); You must also free the resources with ovsrcu_postpone() here: - must call cls_rule_destroy(cr) - must free the tunnel route entry >> + version++; >> + unixctl_command_reply(conn, "OK"); >> + } else { >> + unixctl_command_reply(conn, "Not found"); >> + } >> + >> + ovs_mutex_unlock(&mutex); > > This is a bit of a bummer, but locking here is necessary to make sure that > the ‘cr’ still exists in the classifier when classifier_remove is called. We > should add a new function to take care of this (like > classifier_remove_flow(&cls, &flow, priority) finds the exact matching rule > and removes it if found.) > Jarno _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev