{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/22080","labels_url":"https://api.github.com/repos/saltstack/salt/issues/22080/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/22080/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/22080/events","html_url":"https://github.com/saltstack/salt/issues/22080","id":64737373,"number":22080,"title":"CIDR matching for IPv6 / improve IPv6 support in utils.network","user":{"login":"The-Loeki","id":426731,"avatar_url":"https://avatars.githubusercontent.com/u/426731?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Loeki","html_url":"https://github.com/The-Loeki","followers_url":"https://api.github.com/users/The-Loeki/followers","following_url":"https://api.github.com/users/The-Loeki/following{/other_user}","gists_url":"https://api.github.com/users/The-Loeki/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Loeki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Loeki/subscriptions","organizations_url":"https://api.github.com/users/The-Loeki/orgs","repos_url":"https://api.github.com/users/The-Loeki/repos","events_url":"https://api.github.com/users/The-Loeki/events{/privacy}","received_events_url":"https://api.github.com/users/The-Loeki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-27T10:43:00Z","updated_at":"2015-03-27T10:43:00Z","closed_at":null,"body":"The CIDR matching is currently IPv4 only.\r\n\r\nIt seems not too difficult to get IPv6 support in that as well, and I'm willing to build it.\r\nHowever, looking at the code, the fix/feature will become non-trivial because there's a lot of code duplication/unnecessary functions \r\n\r\nI propose the following changes:\r\n* in `minion.py` the `ipcidr_match` function needs to differentiate between IPv4 & IPv6 addresses; in the simplest form this would be targeting a '.' or ':' in the address/range, and use that to determine the protocol version (and grain to feed into `salt.utils.network.in_subnet`\r\n* in `salt.utils.network` there's a lot of code that should be removed/refactored into using the `ipaddr` module, the compatibility for which is already in `salt.ext`\r\n* then the necessary IPv6 equivalents would need to be added\r\n* `salt.ext.ipaddr` seems a rather old py file, so if it doesn't fit the bill anymore, replace it with https://github.com/phihag/ipaddress, the semi-official compat lib for ipaddr\r\n\r\nIf this is acceptable, I'll start hacking up a (series of) patch(es)\r\nComments? "}}