The branch, master has been updated via 3430448 python/provision: remove unused linklocal=False argument from interface_ips_v6() via 9edc027 s4:samba_upgradedns: don't pass linklocal=False to interface_ips_v6() via 0e6aca4 python/pyglue: filter out loopback and linklocal addresses unless all_interfaces is given from ba04400 vfs_glusterfs: Fix excessive debug output from vfs_gluster_open().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 3430448fc01ce3fbe0606a2c239d3c98a5b78361 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Aug 30 15:18:44 2013 +0200 python/provision: remove unused linklocal=False argument from interface_ips_v6() Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Bjoern Jacke <b...@sernet.de> Autobuild-User(master): Björn Jacke <b...@sernet.de> Autobuild-Date(master): Fri Aug 30 17:33:58 CEST 2013 on sn-devel-104 commit 9edc0276c742194ec381c266acedf3216ccf1c69 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Aug 30 15:17:59 2013 +0200 s4:samba_upgradedns: don't pass linklocal=False to interface_ips_v6() This is the default... Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Bjoern Jacke <b...@sernet.de> commit 0e6aca40413fb3cfd4300f282204a69743be4a65 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Aug 30 14:59:01 2013 +0200 python/pyglue: filter out loopback and linklocal addresses unless all_interfaces is given Bug: https://bugzilla.samba.org/show_bug.cgi?id=10030 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Bjoern Jacke <b...@sernet.de> ----------------------------------------------------------------------- Summary of changes: python/pyglue.c | 45 ++++++++++++++++++++++++++++++- python/samba/provision/__init__.py | 6 ++-- source4/scripting/bin/samba_upgradedns | 2 +- 3 files changed, 47 insertions(+), 6 deletions(-) Changeset truncated at 500 lines: diff --git a/python/pyglue.c b/python/pyglue.c index 735f03a..02fb005 100644 --- a/python/pyglue.c +++ b/python/pyglue.c @@ -164,18 +164,59 @@ static PyObject *py_interface_ips(PyObject *self, PyObject *args) /* first count how many are not loopback addresses */ for (ifcount = i = 0; i<count; i++) { const char *ip = iface_list_n_ip(ifaces, i); - if (!(!all_interfaces && iface_list_same_net(ip, "127.0.0.1", "255.0.0.0"))) { + + if (all_interfaces) { ifcount++; + continue; + } + + if (iface_list_same_net(ip, "127.0.0.1", "255.0.0.0")) { + continue; + } + + if (iface_list_same_net(ip, "169.254.0.0", "255.255.0.0")) { + continue; } + + if (iface_list_same_net(ip, "::1", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")) { + continue; + } + + if (iface_list_same_net(ip, "fe80::", "ffff:ffff:ffff:ffff::")) { + continue; + } + + ifcount++; } pylist = PyList_New(ifcount); for (ifcount = i = 0; i<count; i++) { const char *ip = iface_list_n_ip(ifaces, i); - if (!(!all_interfaces && iface_list_same_net(ip, "127.0.0.1", "255.0.0.0"))) { + + if (all_interfaces) { PyList_SetItem(pylist, ifcount, PyString_FromString(ip)); ifcount++; + continue; + } + + if (iface_list_same_net(ip, "127.0.0.1", "255.0.0.0")) { + continue; + } + + if (iface_list_same_net(ip, "169.254.0.0", "255.255.0.0")) { + continue; } + + if (iface_list_same_net(ip, "::1", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")) { + continue; + } + + if (iface_list_same_net(ip, "fe80::", "ffff:ffff:ffff:ffff::")) { + continue; + } + + PyList_SetItem(pylist, ifcount, PyString_FromString(ip)); + ifcount++; } talloc_free(tmp_ctx); return pylist; diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index a84b92f..89f029a 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -1705,12 +1705,12 @@ def interface_ips_v4(lp): return ret -def interface_ips_v6(lp, linklocal=False): +def interface_ips_v6(lp): """return only IPv6 IPs""" ips = samba.interface_ips(lp, False) ret = [] for i in ips: - if i.find(':') != -1 and (linklocal or i.find('%') == -1): + if i.find(':') != -1: ret.append(i) return ret @@ -2007,7 +2007,7 @@ def provision(logger, session_info, credentials, smbconf=None, if hostip6 is None: logger.info("Looking up IPv6 addresses") - hostips = interface_ips_v6(lp, linklocal=False) + hostips = interface_ips_v6(lp) if hostips: hostip6 = hostips[0] if len(hostips) > 1: diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns index 3c30090..b7af98c 100755 --- a/source4/scripting/bin/samba_upgradedns +++ b/source4/scripting/bin/samba_upgradedns @@ -331,7 +331,7 @@ if __name__ == '__main__': logger.debug("IPv4 addresses: %s" % hostip) logger.info("Looking up IPv6 addresses") - hostip6 = interface_ips_v6(lp, linklocal=False) + hostip6 = interface_ips_v6(lp) if not hostip6: hostip6 = None else: -- Samba Shared Repository