diff --git a/NetworkManager.spec b/NetworkManager.spec index 3eea089..4c4577e 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -14,7 +14,7 @@ Name: NetworkManager Summary: Network connection manager and user applications Epoch: 1 Version: 0.6.5 -Release: 0.11.%{svn_revision}%{?dist} +Release: 0.12.%{svn_revision}%{?dist} Group: System Environment/Base License: GPL URL: http://www.gnome.org/projects/NetworkManager/ @@ -165,6 +165,9 @@ fi %changelog +* Wed Dec 10 2008 Chris Ball - 1:0.6.5-0.12.svn3248 +- OLPC #6028: update to mpp.py from Ricardo Carrano. + * Mon Jun 16 2008 Dennis Gilmore - 1:0.6.5-0.11.svn3248 - update NetworkManager-0.6.5-3206-edit.patch diff --git a/mpp.py b/mpp.py index 9902dcf..50e6558 100644 --- a/mpp.py +++ b/mpp.py @@ -16,6 +16,8 @@ # (C) Copyright 2007 One Laptop Per Child # +#dnsmask script + import commands, sys, syslog, os def get_ip4_address(iface): @@ -96,13 +98,6 @@ def masq_stop(): ipt("-Z") def mpp_start(mesh_dev, primary_dev): - dns_file = file('/etc/resolv.conf','r') - dns_addresses = "" - for line in dns_file.readlines(): - if len(line.split()) >= 2 and line.split()[0] == "nameserver": - dns_addresses += line.split()[1] + ", " - dns_addresses = dns_addresses[:len(dns_addresses) - 2] - dns_file.close() mesh_ip4_addr = get_ip4_address(mesh_dev) if not mesh_ip4_addr or not len(mesh_ip4_addr): @@ -110,34 +105,15 @@ def mpp_start(mesh_dev, primary_dev): primary_hw_addr = get_hw_address(primary_dev).lower() - #copy parameters to the DHCP conf file - dhcpd_conf_text = """#Custom DHCP daemon configuration file - XO as MPP -ddns-update-style interim; - -# free the addresses quickly, clients ignore them anyway -default-lease-time 60; -max-lease-time 60; - -option domain-name-servers %s; - -# Ignore requests from ourselves. Because the 8388's mesh interface has -# the same MAC address as the eth interface, dhclient gets confused -class "me" { - match if hardware = 01:%s; -} - -subnet 169.254.0.0 netmask 255.255.0.0 { - pool { - deny members of "me"; - option routers %s; - # range of link-local addresses, won't be used by XO's - range 169.254.0.1 169.254.255.254; - } -} -""" % (dns_addresses, primary_hw_addr, mesh_ip4_addr) + #copy parameters to the dnsmasq conf file + dnsmasq_conf_text = """# Generated automatically by mpp.py +interface=%s +dhcp-range=169.254.0.1,169.254.255.254,1m +conf-dir=/etc/dnsmasq.d +""" % (mesh_dev) - fd = open("/etc/dhcpd.conf","w") - fd.write(dhcpd_conf_text) + fd = open("/etc/dnsmasq.conf","w") + fd.write(dnsmasq_conf_text) fd.flush() fd.close() @@ -146,19 +122,14 @@ subnet 169.254.0.0 netmask 255.255.0.0 { # Start MPP functionality in mesh firmware set_anycast("0x2", mesh_dev) # mask for xo-as-mpp - # Tell dhcpd to only listen on the mesh interface - fd = open("/etc/sysconfig/dhcpd", "w") - fd.write('DHCPDARGS="%s"' % mesh_dev) - fd.close() - (s, o) = commands.getstatusoutput("service dhcpd restart") + (s, o) = commands.getstatusoutput("service dnsmasq restart") def mpp_stop(mesh_dev, primary_dev): masq_stop() - (s, o) = commands.getstatusoutput("service dhcpd stop") + (s, o) = commands.getstatusoutput("service dnsmasq stop") try: - os.remove("/etc/sysconfig/dhcpd") - os.remove("/etc/dhcpd.conf") + os.remove("/etc/dnsmasq.conf") except OSError, e: pass @@ -179,5 +150,10 @@ def main(): elif action == "meshdown": mpp_stop(mesh_dev, primary_dev) + (sdnsmasq,odnsmasq) = commands.getstatusoutput('rpm -qi dnsmasq') + if (sdnsmasq != 0): + syslog("No dnsmasq in RPM database. Is it installed?") + sys.exit(0) + if __name__ == "__main__": main()