diff options
-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 |