simplebridge: only create network/<network>/bridgeInterface once, also

... fix the tests
The bridge IP is not necessarily the first IP in the subnet.

Example: 172.0.42.1/16 starts at 172.0.0.0.

So the rollover is necessary.


> On Dec 9, 2014, at 3:21 PM, Alexander Morozov <notifications@github.com> wrote:
> 
> In extensions/simplebridge/ipallocator.go <https://github.com/shykes/docker/pull/113#discussion-diff-21571945>:
> 
> > +	)
> > +
> > +	ipMap, err := ip.Refresh()
> > +	if err != nil {
> > +		return nil, err
> > +	}
> > +
> > +	lastip := ip.bridgeNet.IP
> > +
> > +	for {
> > +		rawip := ipToBigInt(lastip)
> > +
> > +		rawip.Add(rawip, big.NewInt(1))
> > +		newip = bigIntToIP(rawip)
> > +
> > +		if !ip.bridgeNet.Contains(newip) {
> I'm still don't understand, you always starting from ip.bridgeNet.IP and here you just reset cycle to it, so it will do same job second time. Also probably you missed continue at the end of this condition, because from such logic you can allocate IP from outside bridgeNet.
> 
> —
> Reply to this email directly or view it on GitHub <https://github.com/shykes/docker/pull/113/files#r21571945>.
>