summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mrouted/igmp.c6
-rw-r--r--usr.sbin/traceroute/traceroute.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/mrouted/igmp.c b/usr.sbin/mrouted/igmp.c
index 1b623ba42ff..2efb6d319b3 100644
--- a/usr.sbin/mrouted/igmp.c
+++ b/usr.sbin/mrouted/igmp.c
@@ -55,7 +55,7 @@ init_igmp()
ip->ip_hl = sizeof(struct ip) >> 2;
ip->ip_v = IPVERSION;
ip->ip_tos = 0;
- ip->ip_off = 0;
+ ip->ip_off = htons(0);
ip->ip_p = IPPROTO_IGMP;
ip->ip_ttl = MAXTTL; /* applies to unicasts only */
@@ -314,7 +314,7 @@ send_igmp(src, dst, type, code, group, datalen)
ip = (struct ip *)send_buf;
ip->ip_src.s_addr = src;
ip->ip_dst.s_addr = dst;
- ip->ip_len = MIN_IP_HEADER_LEN + IGMP_MINLEN + datalen;
+ ip->ip_len = htons(MIN_IP_HEADER_LEN + IGMP_MINLEN + datalen);
igmp = (struct igmp *)(send_buf + MIN_IP_HEADER_LEN);
igmp->igmp_type = type;
@@ -338,7 +338,7 @@ send_igmp(src, dst, type, code, group, datalen)
sdst.sin_len = sizeof(sdst);
#endif
sdst.sin_addr.s_addr = dst;
- if (sendto(igmp_socket, send_buf, ip->ip_len, 0,
+ if (sendto(igmp_socket, send_buf, ntohs(ip->ip_len), 0,
(struct sockaddr *)&sdst, sizeof(sdst)) < 0) {
if (errno == ENETDOWN)
check_vif_state();
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index da93f7b8411..ab33f769f7f 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -432,7 +432,7 @@ main(argc, argv)
ip->ip_dst = gateway[0];
} else
ip->ip_dst = to.sin_addr;
- ip->ip_off = 0;
+ ip->ip_off = htons(0);
ip->ip_hl = (sizeof(struct ip) + lsrrlen) >> 2;
ip->ip_p = IPPROTO_UDP;
ip->ip_v = IPVERSION;
@@ -618,7 +618,7 @@ send_probe(seq, ttl, to)
struct packetdata *op = (struct packetdata *)(up + 1);
int i;
- ip->ip_len = datalen;
+ ip->ip_len = htons(datalen);
ip->ip_ttl = ttl;
ip->ip_id = htons(ident+seq);