diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-06-23 16:15:57 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-06-23 16:15:57 +0000 |
commit | 49c9f8d69c19d87dbdc67c2ce02a8f6b67f49b83 (patch) | |
tree | 3b9ea94ac43aa3e61363aa7b9f556ada85c2d3ef /sys | |
parent | cef2c01a710f772eedb6f3e6ebca133851d5c7d8 (diff) |
Remove unneeded ip_id convertions.
Instead of using HTONS macro in some places, use htons directly in the
struct member and save us a few bytes.
Fix comment.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_ah.c | 7 | ||||
-rw-r--r-- | sys/netinet/ip_ether.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 7 | ||||
-rw-r--r-- | sys/netinet/ip_mroute.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 5 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 3 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 5 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 3 |
8 files changed, 14 insertions, 26 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c index 88d8d91b530..a736d3f688a 100644 --- a/sys/netinet/ip_ah.c +++ b/sys/netinet/ip_ah.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ah.c,v 1.59 2001/06/08 03:13:14 angelos Exp $ */ +/* $OpenBSD: ip_ah.c,v 1.60 2001/06/23 16:15:56 fgsch Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -212,14 +212,13 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out) ip->ip_sum = 0; /* - * On input, fix ip_len and ip_id, which have been byte-swapped - * at ip_intr() + * On input, fix ip_len which has been byte-swapped + * at ip_input() */ if (!out) { ip->ip_len += skip; HTONS(ip->ip_len); - HTONS(ip->ip_id); if ((alg == CRYPTO_MD5_KPDK) || (alg == CRYPTO_SHA1_KPDK)) ip->ip_off = htons(ip->ip_off & IP_DF); diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index 383b47c6126..cfb868eeaff 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.29 2001/06/19 00:48:22 deraadt Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.30 2001/06/23 16:15:56 fgsch Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) @@ -370,8 +370,7 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, ipo->ip_tos = 0; ipo->ip_off = 0; ipo->ip_sum = 0; - ipo->ip_id = ip_randomid(); - HTONS(ipo->ip_id); + ipo->ip_id = htons(ip_randomid()); /* * We should be keeping tunnel soft-state and send back diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index d2041d5c5a6..1157935fcf1 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.79 2001/06/23 05:55:40 angelos Exp $ */ +/* $OpenBSD: ip_input.c,v 1.80 2001/06/23 16:15:56 fgsch Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -352,7 +352,6 @@ ipv4_input(m) ipstat.ips_badlen++; goto bad; } - NTOHS(ip->ip_id); NTOHS(ip->ip_off); /* @@ -417,13 +416,11 @@ ipv4_input(m) * as expected when ip_mforward() is called from * ip_output().) */ - ip->ip_id = htons(ip->ip_id); if (ip_mforward(m, m->m_pkthdr.rcvif) != 0) { ipstat.ips_cantforward++; m_freem(m); return; } - ip->ip_id = ntohs(ip->ip_id); /* * The process-level routing demon needs to receive @@ -1129,7 +1126,6 @@ ip_dooptions(m) return (0); bad: ip->ip_len -= ip->ip_hl << 2; /* XXX icmp_error adds in hdr length */ - HTONS(ip->ip_id); icmp_error(m, type, code, 0, 0); ipstat.ips_badoptions++; return (1); @@ -1379,7 +1375,6 @@ ip_forward(m, srcrt) m_freem(m); return; } - HTONS(ip->ip_id); if (ip->ip_ttl <= IPTTLDEC) { icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, dest, 0); return; diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 53e8cc91415..1e6aaac6440 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.20 2000/11/10 15:33:10 provos Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.21 2001/06/23 16:15:56 fgsch Exp $ */ /* $NetBSD: ip_mroute.c,v 1.27 1996/05/07 02:40:50 thorpej Exp $ */ /* @@ -1417,8 +1417,7 @@ encap_send(ip, vifp, m) */ ip_copy = mtod(mb_copy, struct ip *); *ip_copy = multicast_encap_iphdr; - ip_copy->ip_id = ip_randomid(); - HTONS(ip_copy->ip_id); + ip_copy->ip_id = htons(ip_randomid()); ip_copy->ip_len = len; ip_copy->ip_src = vifp->v_lcl_addr; ip_copy->ip_dst = vifp->v_rmt_addr; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index bf395467286..91a1c4ff62c 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.111 2001/06/23 07:13:03 angelos Exp $ */ +/* $OpenBSD: ip_output.c,v 1.112 2001/06/23 16:15:56 fgsch Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -148,8 +148,7 @@ ip_output(m0, va_alist) if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) { ip->ip_v = IPVERSION; ip->ip_off &= IP_DF; - ip->ip_id = ip_randomid(); - HTONS(ip->ip_id); + ip->ip_id = htons(ip_randomid()); ip->ip_hl = hlen >> 2; ipstat.ips_localout++; } else { diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index 3a5d659f5f2..c570ddf0e33 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.44 2001/06/19 00:48:23 deraadt Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.45 2001/06/23 16:15:56 fgsch Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -285,7 +285,6 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff, ip = mtod(m, struct ip *); ip->ip_len = htons(m->m_pkthdr.len); - HTONS(ip->ip_id); HTONS(ip->ip_off); ip->ip_sum = 0; ip->ip_sum = in_cksum(m, ip->ip_hl << 2); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index ac3f2b02829..c9c4b08002b 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.23 2001/06/08 03:53:46 angelos Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.24 2001/06/23 16:15:56 fgsch Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -244,8 +244,7 @@ rip_output(m, va_alist) return (EINVAL); } if (ip->ip_id == 0) { - ip->ip_id = ip_randomid(); - HTONS(ip->ip_id); + ip->ip_id = htons(ip_randomid()); } /* XXX prevent ip_output from overwriting header fields */ flags |= IP_RAWOUTPUT; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 4f60d3f7ec4..663f559fbd4 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.68 2001/06/23 07:14:32 angelos Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.69 2001/06/23 16:15:56 fgsch Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -528,7 +528,6 @@ udp_input(m, va_alist) #endif /* INET6 */ { *ip = save_ip; - HTONS(ip->ip_id); uh->uh_sum = savesum; icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); |