summaryrefslogtreecommitdiff
path: root/net/ping.c
diff options
context:
space:
mode:
authorDuncan Hare <DH@Synoia.com>2018-06-24 15:40:41 -0700
committerJoe Hershberger <joe.hershberger@ni.com>2018-10-10 12:29:02 -0500
commit5d457ecbef5eba8eaeed513c65c55453de4f3975 (patch)
tree2046aacfd0d999c3dd5d82fea12826751c1e4714 /net/ping.c
parentac3f26cc15ad7e3e9efc2b0b0e18c6e84d93af77 (diff)
net: Consolidate UDP header functions
Make it possible to add TCP versions of the same, while reusing IP portions. This patch should not change any behavior. Signed-off-by: Duncan Hare <DH@Synoia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/ping.c')
-rw-r--r--net/ping.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/net/ping.c b/net/ping.c
index 821d35d01d..633c942e67 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -22,14 +22,9 @@ static void set_icmp_header(uchar *pkt, struct in_addr dest)
/*
* Construct an IP and ICMP header.
*/
- struct ip_hdr *ip = (struct ip_hdr *)pkt;
struct icmp_hdr *icmp = (struct icmp_hdr *)(pkt + IP_HDR_SIZE);
- net_set_ip_header(pkt, dest, net_ip);
-
- ip->ip_len = htons(IP_ICMP_HDR_SIZE);
- ip->ip_p = IPPROTO_ICMP;
- ip->ip_sum = compute_ip_checksum(ip, IP_HDR_SIZE);
+ net_set_ip_header(pkt, dest, net_ip, IP_ICMP_HDR_SIZE, IPPROTO_ICMP);
icmp->type = ICMP_ECHO_REQUEST;
icmp->code = 0;