mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpctl: Add support for using UFID to add/del flows.
Parse "ufid:<foo>" at the beginning of a flow specification and use it for flow manipulation if present. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -1999,6 +1999,41 @@ generate_all_wildcard_mask(struct ofpbuf *ofp, const struct nlattr *key)
|
||||
return ofpbuf_base(ofp);
|
||||
}
|
||||
|
||||
int
|
||||
odp_ufid_from_string(const char *s_, ovs_u128 *ufid)
|
||||
{
|
||||
const char *s = s_;
|
||||
|
||||
if (ovs_scan(s, "ufid:")) {
|
||||
size_t n;
|
||||
|
||||
s += 5;
|
||||
if (ovs_scan(s, "0x")) {
|
||||
s += 2;
|
||||
}
|
||||
|
||||
n = strspn(s, "0123456789abcdefABCDEF");
|
||||
if (n != 32) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!ovs_scan(s, "%"SCNx64, &ufid->u64.hi)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s += 16;
|
||||
|
||||
if (!ovs_scan(s, "%"SCNx64, &ufid->u64.lo)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s += 16;
|
||||
s += strspn(s, delimiters);
|
||||
|
||||
return s - s_;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
odp_format_ufid(const ovs_u128 *ufid, struct ds *ds)
|
||||
{
|
||||
|
Reference in New Issue
Block a user