Pass in a database connection to {get_new,free}_network_id

This solves a problem where an ID could be allocated, and then the system
could crash before it was assigned to a network, causing an ID leak.  Now both
operations are in one transaction.
Document reason for previous change
Merge pull request #167 from gsilvis/driver-db-pass

Pass database connection to network id allocation/freeing