send.c: add new_prefix function

This code will be used in each of the three cases in build_prefix_list so
it makes sense to factor it out.
send.c: use new_prefix()
send.c: change while loop to do/while
send.c: fixup if6 prefix list code