Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-08 Thread Martin Langhoff
On Fri, Feb 6, 2009 at 3:31 PM, Daniel Drake d...@laptop.org wrote:
 2009/2/5 Martin Langhoff martin.langh...@gmail.com:
 Sure can do, and there is a related change other people have asked for
 (free addresses for the APs themselves, so that the telnet or webbased
 config UIs can be used).

 Great. Can you pick a range so that I can make the assignment locally too?

Done. The 'olpcxs-testing' repo now has an xs-config (0.6.0.4.g...)
that includes this commit. Should be good for your APs which need a
range for administration and activation.

http://dev.laptop.org/git?p=projects/xs-config;a=commitdiff;h=207a04421f9076a7986bd8f274849ac8dcf522d8


--- a/altfiles/etc/sysconfig/olpc-scripts/dhcpd.conf.1
+++ b/altfiles/etc/sysconfig/olpc-scripts/dhcpd.conf.1
@@ -12,8 +12,16 @@ subnet 172.18.96.0 netmask 255.255.224.0 {
option routers  172.18.96.1;
option subnet-mask  255.255.224.0;
option broadcast-address172.18.127.255;
-   range   172.18.96.2 172.18.127.254;
-
+   # this is the whole range we have available - 8K addresses
+   # range   172.18.96.2 172.18.127.254;
+   # instead, we'll save 510 addresses for later.
+   range   172.18.96.2 172.18.125.254;
+   # the other /24s:
+   # - 172.18.126.0/24 for static IP addresses
+   #for printers, AP management consoles, etc.
+   # - 172.18.127.0/24 for temporary addresses for
+   #XO activation
+
 # As this subnet is wired or wifi a/b/g, these lease
#times are on the long side
default-lease-time  10800;

cheers,



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-08 Thread Martin Langhoff
On Mon, Feb 9, 2009 at 5:57 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
 Done. The 'olpcxs-testing' repo now has an xs-config (0.6.0.4.g...)
 that includes this commit. Should be good for your APs which need a
 range for administration and activation.

http://wiki.laptop.org/go/XS_Network#Network_devices

Our handing out of dhcp leases from different (potential) servers, and
various interfaces is a bit of a gnarly thing.

For the time being, I've documented the IPv4 addresses and ranges, as
well as these 2 new IPv6 hardcoded link-local addresses. Going
forward, we can get rid of a lot of complexity by forgetting the many
servers thing, specially wrt mesh.

By which I mean: If we are using mesh, we are strictly in a
single-server environment. Small school, la la la.

cheers,


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-08 Thread Martin Langhoff
On Mon, Feb 9, 2009 at 5:57 PM, Martin Langhoff
martin.langh...@gmail.com wrote:
 Done. The 'olpcxs-testing' repo now has an xs-config (0.6.0.4.g...)
 that includes this commit. Should be good for your APs which need a
 range for administration and activation.

http://wiki.laptop.org/go/XS_Network#Network_devices

Our handing out of dhcp leases from different (potential) servers, and
various interfaces is a bit of a gnarly thing.

For the time being, I've documented the IPv4 addresses and ranges, as
well as these 2 new IPv6 hardcoded link-local addresses. Going
forward, we can get rid of a lot of complexity by forgetting the many
servers thing, specially wrt mesh.

By which I mean: If we are using mesh, we are strictly in a
single-server environment. Small school, la la la.

cheers,


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-05 Thread Daniel Drake
2009/2/4 Martin Langhoff martin.langh...@gmail.com:
 Great -- I am not too conversant on the initrd code, probably makes
 sense to repost it to devel@ where cscott and mstone lurk...

Yes, but I would prefer to sort out the networking first.

 The XS routing routes 172.18.16.xx the first active antenna (if
 present). DHCP never assigns an IP address on that range.

Ah. Doesn't work without an AA though.

 According to Wad's original schema, where the plan was to scale out
 aggressively, the 172.18.1.x range was for the main wired NIC of each
 XS. My plan is to scale up before we scale out (farming out highly
 integrated services without causing havoc and bottlenecks is
 non-trivial), but I am keeping the same routing model as scaling out
 is still a valid strategy.

 Still, the potential number of XSs in a network is very low.

 So a safe thing would be to pick a random IP address in
 172.18.1.128/25 when using a/b/g accesspoints, and 172.18.16.xx when
 trying mesh channels.

Can I persuade you to add a new range for the IBSS-STA XOs that are
requesting leases over IPv4? 126 addresses is not many when XOs will
be assigning them randomly, we will have kids arriving at school at
the same time, and many laptops expiring on the same day.

Thanks,
Daniel
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-05 Thread Martin Langhoff
On Fri, Feb 6, 2009 at 1:11 AM, Daniel Drake d...@laptop.org wrote:
 Can I persuade you to add a new range for the IBSS-STA XOs that are
 requesting leases over IPv4? 126 addresses is not many when XOs will
 be assigning them randomly, we will have kids arriving at school at
 the same time, and many laptops expiring on the same day.

Sure can do, and there is a related change other people have asked for
(free addresses for the APs themselves, so that the telnet or webbased
config UIs can be used).

BTW, I am not against having a usable IPv6 setup _as well as_ IPv4. It
is just not high priority for me; none of the deployments we're eyeing
stretches the IPv4 limits, and I cannot drop IPv4 infra either. Not to
mention the rough edges in IPv6 support.

If anyone is keen on seeing IPv6 on the XS... it would be fantastic to
get you involved. Each step is very small, bringing it to fruition has
a lot of steps involved... and it is waiting for you :-)

cheers,



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
server-de...@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-05 Thread Daniel Drake
2009/2/5 Martin Langhoff martin.langh...@gmail.com:
 Sure can do, and there is a related change other people have asked for
 (free addresses for the APs themselves, so that the telnet or webbased
 config UIs can be used).

Great. Can you pick a range so that I can make the assignment locally too?

 BTW, I am not against having a usable IPv6 setup _as well as_ IPv4. It
 is just not high priority for me; none of the deployments we're eyeing
 stretches the IPv4 limits, and I cannot drop IPv4 infra either. Not to
 mention the rough edges in IPv6 support.

OK. Activation over IPv6 is nice and easy though, see my other mail, I
hope you'll consider it as an initial step :)
___
Server-devel mailing list
server-de...@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


[Server-devel] Network addressing for activation-over-IBSS

2009-02-04 Thread Daniel Drake
Hi,

I have modified the XO activation initramfs to attempt to locate a
lease server on an XS on each open infrastructure network that can be
found (early patch attached).

The XS does not bind the server to the IPv6 address correctly (perhaps
we can work on that)., so it currently runs over IPv4

But assuming we want a working IPv4 implementation... we need to
figure out a way of getting the XOs to address themselves in a way
compatible with the school server. The current IPv4 code picks an
address (randomly) at 172.18.16.xx and this does not work with the XS.
I also am quite confused by the XS network interface setting.

We need to choose an appropriate address range which the XOs can
suitably randomly assign themselves in, not covered by DHCP leases,
and make sure that an appropriate interface is listening (at least
acting as a gateway) on the XS. At the moment I am using 172.18.1.x
which seems to be free of dhcp assignments.

Thoughts?
Daniel

From: Daniel Drake d...@laptop.org

diff --git a/src-olpc/activate.py b/src-olpc/activate.py
index f21b30d..f9b27e7 100644
--- a/src-olpc/activate.py
+++ b/src-olpc/activate.py
@@ -6,10 +6,14 @@ from initutil import blk_mounted, SD_DEV, SD_MNT, USB_DEV, USB_MNT
 from initutil import sd_init, usb_init, net_init
 from socket import *
 from ipv6util import if_nametoindex
+import subprocess
 from subprocess import check_call, call
 sys.path += [ '/act-gui' ] # gui_client is in a subdir
 from gui_client import send
 
+#def send(foo):
+#print would send:, foo
+
 def try_blk(device, mnt, fstype='msdos'):
 Try to mount a block device and read keylist from it.
 try:
@@ -19,25 +23,60 @@ def try_blk(device, mnt, fstype='msdos'):
 except:
 return None
 
-def select_network_channel (channel):
-check_call(['/sbin/iwconfig','eth0','mode','ad-hoc','essid','dontcare'])
-check_call(['/sbin/iwconfig','msh0','channel',str(channel)])
-check_call(['/bin/ip','link','set','dev','msh0','up']) # rely on ipv6 autoconfig
+def set_addresses (iface):
 # set up link-local address
-mac = open('/sys/class/net/msh0/address').read().strip().split(':')
+mac = open('/sys/class/net/%s/address' % iface).read().strip().split(':')
 top = int(mac[0], 16) ^ 2 # universal/local bit complemented
 ll = 'fe80::%02x%s:%sff:fe%s:%s%s' % \
  (top, mac[1], mac[2], mac[3], mac[4], mac[5])
-call(['/bin/ip', 'addr', 'add', '%s/64' % ll, 'dev', 'msh0'])
+call(['/bin/ip', 'addr', 'add', '%s/64' % ll, 'dev', iface])
 a = 2+(ord(os.urandom(1)[0])%250)
-call(['/bin/ip', 'addr', 'add', '172.18.16.%d' % a, 'dev', 'msh0'])
+call(['/bin/ip', 'addr', 'add', '172.18.1.%d/24' % a,
+  'brd', '172.18.1.255', 'dev', iface])
 # XXX: BSSIDs of all 0, F, or 4 are invalid
-# set up route to 172.18.0.1
-call(['/bin/ip', 'route', 'add', '172.18.0.0/23', 'dev', 'msh0'])
-call(['/bin/ip', 'route', 'add', 'default', 'via', '172.18.0.1'])
+call(['/bin/ip', 'route', 'add', 'default', 'via', '172.18.1.1', 'dev', iface])
 # should be able to ping 172.18.0.1 after this point.
 # the IPv4 address is a little hacky, prefer ipv6
 
+def select_mesh_channel (channel):
+check_call(['/sbin/iwconfig','eth0','mode','ad-hoc','essid','dontcare'])
+check_call(['/sbin/iwconfig','msh0','channel',str(channel)])
+check_call(['/bin/ip','link','set','dev','msh0','up']) # rely on ipv6 autoconfig
+set_addresses('msh0')
+
+def select_ibss (ssid):
+print attempting connection to open IBSS, ssid
+check_call(['/bin/ip','link','set','dev','eth0','up']) # rely on ipv6 autoconfig
+check_call(['/sbin/iwconfig','eth0','mode','managed','essid',ssid])
+
+# wait for association, max 5 secs
+for i in range(0, 10):
+time.sleep(0.5)
+output = subprocess.Popen([/sbin/iwconfig, eth0],
+  stdout=subprocess.PIPE).communicate()[0]
+lines = output.split(\n)
+if len(lines)  2:
+print bad iwconfig output?
+return False
+
+ssidpos = lines[0].index(ESSID:)
+iw_ssid = lines[0][ssidpos + 6:].strip()
+if iw_ssid != '' + ssid + '':
+if iw_ssid != '':
+print unexpected ESSID value:, iw_ssid
+continue
+
+appos = lines[1].find(Access Point: )
+if appos == -1:
+continue
+iw_ap = lines[1][appos+14:].strip()
+if iw_ap[0].isdigit():
+print connected!
+set_addresses(eth0)
+return True
+
+return False
+
 def try_to_get_lease(family, addr, serial_num):
 s = socket(family, SOCK_STREAM)
 try:
@@ -55,23 +94,87 @@ def try_to_get_lease(family, addr, serial_num):
 finally:
 s.close()
 
-def try_network (channel, serial_num):
+def contact_lease_server (iface, serial_num):
+# try to contact the lease server
+for family, addr in [ (AF_INET6,('fe80::abcd:ef01',191,
+  

Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-04 Thread John Gilmore
  The XS does not bind the server to the IPv6 address correctly (perhaps
  we can work on that)., so it currently runs over IPv4
 
 True - the XS runs an IPv4 infra.

IPv6 offers link-level addresses that don't require any
infrastructure, not even a DHCP server.  If you make both ends work
with IPv6 then you don't have to worry about assigning addresses at
all.

And you can send a UDP query to an IPv6 link-level multicast address,
so you don't need to know the school server's address.  It can respond
via unicast to your link-level address.  Many nodes who want to offer
leases can listen on that multicast address (the only one that should
respond is one who has a lease to offer this client).

(It doesn't appear to work to use IPv4 link-local addresses in this
application, because one is not always assigned; while in IPv6,
whenever your interface comes up, a link-local address is rapidly
assigned to it.)

John

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-04 Thread Wade Brainerd
On Thu, 5 Feb 2009, Martin Langhoff wrote:

 2009/2/5 Daniel Drake d...@laptop.org:
 I have modified the XO activation initramfs to attempt to locate a
 lease server on an XS on each open infrastructure network that can be
 found (early patch attached).

 Great -- I am not too conversant on the initrd code, probably makes
 sense to repost it to devel@ where cscott and mstone lurk...

I can possibly help too w.r.t. the OLPC initramfs, I have hacked it up to 
the point of not needing it but I have a general idea how it works.

If you need to make simple modifications, Google Building Initramfsen 
for a simple guide.

-Wade
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: [Server-devel] Network addressing for activation-over-IBSS

2009-02-04 Thread Martin Langhoff
On Thu, Feb 5, 2009 at 3:13 PM, Wade Brainerd r...@wadeb.com wrote:
 I can possibly help too w.r.t. the OLPC initramfs, I have hacked it up to
 the point of not needing it but I have a general idea how it works.

dsd is proposing a patch. Might merit review :-)
http://lists.laptop.org/pipermail/server-devel/2009-February/002823.html

 If you need to make simple modifications, Google Building Initramfsen for
 a simple guide.

Yes, I've been through that once :-/


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Server-devel mailing list
server-de...@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel