net: Refactor IP, UPD, and ICMP header writing functions

ICMP (ping) was reimplementing IP header code... it now shares code.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/net/bootp.c b/net/bootp.c
index 009369b..7346993 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -619,9 +619,9 @@
 	 * determined.
 	 * C. Hallinan, DS4.COM, Inc.
 	 */
-	/* NetSetIP(pkt, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC,
+	/* net_set_udp_header(pkt, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC,
 		sizeof (struct Bootp_t)); */
-	iphdr = pkt;	/* We need this later for NetSetIP() */
+	iphdr = pkt;	/* We need this later for net_set_udp_header() */
 	pkt += IP_UDP_HDR_SIZE;
 
 	bp = (struct Bootp_t *)pkt;
@@ -663,7 +663,7 @@
 	pktlen = ((int)(pkt-NetTxPacket)) + BOOTP_HDR_SIZE -
 		sizeof(bp->bp_vend) + ext_len;
 	iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + ext_len;
-	NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
+	net_set_udp_header(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
 	NetSetTimeout(SELECT_TIMEOUT, BootpTimeout);
 
 #if defined(CONFIG_CMD_DHCP)
@@ -844,7 +844,7 @@
 	pktlen = ((int)(pkt-NetTxPacket)) + BOOTP_HDR_SIZE -
 		sizeof(bp->bp_vend) + extlen;
 	iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
-	NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
+	net_set_udp_header(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
 
 	debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
 #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY