[r=julian-edwards][bug=1387262][author=julian-edwards] Backport r3337: Use a lock in the critical section of the code that finds and records a new static IP address in the database. Some users have reported errors in the PG log file complaining about inserting duplicates, so there must be a race.