faucetsdn / faucet

FAUCET is an OpenFlow controller for multi table OpenFlow 1.3 switches, that implements layer 2 switching, VLANs, ACLs, and layer 3 IPv4 and IPv6 routing.
http://faucet.nz
Apache License 2.0
560 stars 192 forks source link

Unhandled exception when acl rule doesn't have a valid ipv6 address #1321

Closed mab68 closed 6 years ago

mab68 commented 6 years ago

Config:

acls:
    office-vlan-protect:
        - rule:
            dl_type: 0x800
            ipv6_src: 10.0.100.0/24
            ipv4_src: 10.0.200.0/24
vlans:
    office:
        vid: 100
        acl_in: office-vlan-protect
dps:
    sw1:
        dp_id: 0x1
        interfaces:
            1:
                native_vlan: office

Error:

Dec 01 01:03:24 faucet.exception ERROR    Unhandled exception, killing RYU
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/netaddr/strategy/ipv6.py", line 139, in str_to_int
    packed_int = _inet_pton(AF_INET6, addr)
OSError: illegal IP address string passed to inet_pton

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 311, in __init__
    self._value = self._module.str_to_int(addr, flags)
  File "/usr/lib/python3.6/site-packages/netaddr/strategy/ipv6.py", line 142, in str_to_int
    raise AddrFormatError('%r is not a valid IPv6 address string!' % addr)
netaddr.core.AddrFormatError: '10.0.100.0' is not a valid IPv6 address string!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ryu/lib/addrconv.py", line 29, in text_to_bin
    return self._addr(text, **self._addr_kwargs).packed
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 314, in __init__
    % (addr, self._module.version))
netaddr.core.AddrFormatError: base address '10.0.100.0' is not IPv6

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/netaddr/strategy/ipv6.py", line 139, in str_to_int
    packed_int = _inet_pton(AF_INET6, addr)
OSError: illegal IP address string passed to inet_pton

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 311, in __init__
    self._value = self._module.str_to_int(addr, flags)
  File "/usr/lib/python3.6/site-packages/netaddr/strategy/ipv6.py", line 142, in str_to_int
    raise AddrFormatError('%r is not a valid IPv6 address string!' % addr)
netaddr.core.AddrFormatError: '10.0.100.0' is not a valid IPv6 address string!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 791, in parse_ip_network
    ip = IPAddress(val1, module.version, flags=INET_PTON)
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 314, in __init__
    % (addr, self._module.version))
netaddr.core.AddrFormatError: base address '10.0.100.0' is not IPv6

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/faucet/valve_util.py", line 34, in __koe
    func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/faucet/faucet.py", line 198, in _load_configs
    new_config_hashes, new_dps = dp_parser(new_config_file, self.logname)
  File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 51, in dp_parser
    config_hashes, dps = _config_parser_v2(config_file, logname)
  File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 188, in _config_parser_v2
    top_confs['vlans'])
  File "/usr/lib/python3.6/site-packages/faucet/config_parser.py", line 162, in _dp_parser_v2
    dp.finalize_config(dps)
  File "/usr/lib/python3.6/site-packages/faucet/dp.py", line 560, in finalize_config
    resolve_acls()
  File "/usr/lib/python3.6/site-packages/faucet/dp.py", line 521, in resolve_acls
    build_acl(vlan.acl_in, vid=1)
  File "/usr/lib/python3.6/site-packages/faucet/dp.py", line 511, in build_acl
    vlan_vid=vid)
  File "/usr/lib/python3.6/site-packages/faucet/valve_acl.py", line 140, in build_acl_ofmsgs
    rule_conf, acl_allow_inst, meters, port_num, vlan_vid)
  File "/usr/lib/python3.6/site-packages/faucet/valve_acl.py", line 128, in build_acl_entry
    acl_match = valve_of.match_from_dict(match_dict)
  File "/usr/lib/python3.6/site-packages/faucet/valve_of.py", line 398, in match_from_dict
    return parser.OFPMatch(**kwargs)
  File "/usr/lib/python3.6/site-packages/ryu/ofproto/ofproto_v1_3_parser.py", line 865, in __init__
    in kwargs.items()]
  File "/usr/lib/python3.6/site-packages/ryu/ofproto/ofproto_v1_3_parser.py", line 864, in <listcomp>
    fields = [ofproto.oxm_from_user(k, v) for (k, v)
  File "/usr/lib/python3.6/site-packages/ryu/ofproto/oxx_fields.py", line 72, in _from_user
    value = t.from_user(value)
  File "/usr/lib/python3.6/site-packages/ryu/lib/addrconv.py", line 36, in text_to_bin
    ip = self._fallback(text, **self._addr_kwargs)
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 920, in __init__
    implicit_prefix=implicit_prefix, flags=flags)
  File "/usr/lib/python3.6/site-packages/netaddr/ip/__init__.py", line 798, in parse_ip_network
    raise AddrFormatError('invalid IPNetwork address %s!' % addr)
netaddr.core.AddrFormatError: invalid IPNetwork address 10.0.100.0!
anarkiwi commented 6 years ago

https://github.com/faucetsdn/faucet/commit/d606e9be245e643651a3e6574d4f14e29598c6ac