rpms/NetworkManager/OLPC-3 NetworkManager.spec, 1.227, 1.228 mpp.py, 1.1, 1.2

Chris Ball cjb at fedoraproject.org
Wed Dec 10 22:48:36 UTC 2008


Author: cjb

Update of /cvs/pkgs/rpms/NetworkManager/OLPC-3
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24260

Modified Files:
	NetworkManager.spec mpp.py 
Log Message:
* Wed Dec 10 2008 Chris Ball <cjb at laptop.org> - 1:0.6.5-0.12.svn3248
- OLPC #6028: update to mpp.py from Ricardo Carrano.



Index: NetworkManager.spec
===================================================================
RCS file: /cvs/pkgs/rpms/NetworkManager/OLPC-3/NetworkManager.spec,v
retrieving revision 1.227
retrieving revision 1.228
diff -u -r1.227 -r1.228
--- NetworkManager.spec	16 Jun 2008 20:30:50 -0000	1.227
+++ NetworkManager.spec	10 Dec 2008 22:48:05 -0000	1.228
@@ -14,7 +14,7 @@
 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 @@
 
 
 %changelog
+* Wed Dec 10 2008 Chris Ball <cjb at laptop.org> - 1:0.6.5-0.12.svn3248
+- OLPC #6028: update to mpp.py from Ricardo Carrano.
+
 * Mon Jun 16 2008 Dennis Gilmore <dennis at ausil.us> - 1:0.6.5-0.11.svn3248
 - update NetworkManager-0.6.5-3206-edit.patch 
 


Index: mpp.py
===================================================================
RCS file: /cvs/pkgs/rpms/NetworkManager/OLPC-3/mpp.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mpp.py	9 May 2008 20:32:15 -0000	1.1
+++ mpp.py	10 Dec 2008 22:48:05 -0000	1.2
@@ -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 @@
     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 @@
 
     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 @@
     # 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 @@
     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()




More information about the fedora-extras-commits mailing list