diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-28 22:54:10 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-28 22:54:10 +0900 |
commit | bd4bde945e5a6c2a538584bbf4257550dff49742 (patch) | |
tree | 043f221bc904594a89b157581a059fe7e9e5f63c | |
parent | a962e9a472105ff8b37c40ca05c2bb2e4a91a188 (diff) |
ofctl_v1_2, 3: Fix regression of IP arbitrary bitmask support
Reported-by: Wei-Li Tang <alextwl@xinguard.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Wei-Li Tang <alextwl@xinguard.com>
-rw-r--r-- | ryu/lib/ofctl_v1_2.py | 8 | ||||
-rw-r--r-- | ryu/lib/ofctl_v1_3.py | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py index c8b91743..81b39156 100644 --- a/ryu/lib/ofctl_v1_2.py +++ b/ryu/lib/ofctl_v1_2.py @@ -285,9 +285,11 @@ def to_match_eth(value): def to_match_ip(value): if '/' in value: - ip = netaddr.ip.IPNetwork(value) - ip_addr = str(ip.ip) - ip_mask = str(ip.netmask) + (ip_addr, ip_mask) = value.split('/') + if ip_mask.isdigit(): + ip = netaddr.ip.IPNetwork(value) + ip_addr = str(ip.ip) + ip_mask = str(ip.netmask) return ip_addr, ip_mask else: return value diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 485a3b4e..4372e53b 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -306,9 +306,11 @@ def to_match_eth(value): def to_match_ip(value): if '/' in value: - ip = netaddr.ip.IPNetwork(value) - ip_addr = str(ip.ip) - ip_mask = str(ip.netmask) + (ip_addr, ip_mask) = value.split('/') + if ip_mask.isdigit(): + ip = netaddr.ip.IPNetwork(value) + ip_addr = str(ip.ip) + ip_mask = str(ip.netmask) return ip_addr, ip_mask else: return value |