diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-03-07 00:19:10 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:23:58 -0400 |
commit | 4412ec494868160d57da6e436a92b0696f40b19d (patch) | |
tree | 91bb2477d22a95801a5c487349e89acb464793ec /net/ipv4 | |
parent | 1c9e8ef7f731c2548414644e5bf540c38c85aff0 (diff) |
[NET] IPV4: Use hton{s,l}() where appropriate.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_core.c | 10 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_proto_ah.c | 16 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_xmit.c | 16 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_proto_tcp.c | 9 |
4 files changed, 25 insertions, 26 deletions
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c index 24d7b66eb6d2..858686d616a2 100644 --- a/net/ipv4/ipvs/ip_vs_core.c +++ b/net/ipv4/ipvs/ip_vs_core.c | |||
@@ -617,7 +617,7 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related) | |||
617 | *related = 1; | 617 | *related = 1; |
618 | 618 | ||
619 | /* reassemble IP fragments */ | 619 | /* reassemble IP fragments */ |
620 | if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) { | 620 | if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { |
621 | skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT); | 621 | skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT); |
622 | if (!skb) | 622 | if (!skb) |
623 | return NF_STOLEN; | 623 | return NF_STOLEN; |
@@ -659,7 +659,7 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related) | |||
659 | return NF_ACCEPT; | 659 | return NF_ACCEPT; |
660 | 660 | ||
661 | /* Is the embedded protocol header present? */ | 661 | /* Is the embedded protocol header present? */ |
662 | if (unlikely(cih->frag_off & __constant_htons(IP_OFFSET) && | 662 | if (unlikely(cih->frag_off & htons(IP_OFFSET) && |
663 | pp->dont_defrag)) | 663 | pp->dont_defrag)) |
664 | return NF_ACCEPT; | 664 | return NF_ACCEPT; |
665 | 665 | ||
@@ -755,7 +755,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, | |||
755 | return NF_ACCEPT; | 755 | return NF_ACCEPT; |
756 | 756 | ||
757 | /* reassemble IP fragments */ | 757 | /* reassemble IP fragments */ |
758 | if (unlikely(iph->frag_off & __constant_htons(IP_MF|IP_OFFSET) && | 758 | if (unlikely(iph->frag_off & htons(IP_MF|IP_OFFSET) && |
759 | !pp->dont_defrag)) { | 759 | !pp->dont_defrag)) { |
760 | skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT); | 760 | skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT); |
761 | if (!skb) | 761 | if (!skb) |
@@ -861,7 +861,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum) | |||
861 | *related = 1; | 861 | *related = 1; |
862 | 862 | ||
863 | /* reassemble IP fragments */ | 863 | /* reassemble IP fragments */ |
864 | if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) { | 864 | if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { |
865 | skb = ip_vs_gather_frags(skb, | 865 | skb = ip_vs_gather_frags(skb, |
866 | hooknum == NF_IP_LOCAL_IN ? | 866 | hooknum == NF_IP_LOCAL_IN ? |
867 | IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD); | 867 | IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD); |
@@ -905,7 +905,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum) | |||
905 | return NF_ACCEPT; | 905 | return NF_ACCEPT; |
906 | 906 | ||
907 | /* Is the embedded protocol header present? */ | 907 | /* Is the embedded protocol header present? */ |
908 | if (unlikely(cih->frag_off & __constant_htons(IP_OFFSET) && | 908 | if (unlikely(cih->frag_off & htons(IP_OFFSET) && |
909 | pp->dont_defrag)) | 909 | pp->dont_defrag)) |
910 | return NF_ACCEPT; | 910 | return NF_ACCEPT; |
911 | 911 | ||
diff --git a/net/ipv4/ipvs/ip_vs_proto_ah.c b/net/ipv4/ipvs/ip_vs_proto_ah.c index 8b0505b09317..a842676e1c69 100644 --- a/net/ipv4/ipvs/ip_vs_proto_ah.c +++ b/net/ipv4/ipvs/ip_vs_proto_ah.c | |||
@@ -52,15 +52,15 @@ ah_conn_in_get(const struct sk_buff *skb, | |||
52 | if (likely(!inverse)) { | 52 | if (likely(!inverse)) { |
53 | cp = ip_vs_conn_in_get(IPPROTO_UDP, | 53 | cp = ip_vs_conn_in_get(IPPROTO_UDP, |
54 | iph->saddr, | 54 | iph->saddr, |
55 | __constant_htons(PORT_ISAKMP), | 55 | htons(PORT_ISAKMP), |
56 | iph->daddr, | 56 | iph->daddr, |
57 | __constant_htons(PORT_ISAKMP)); | 57 | htons(PORT_ISAKMP)); |
58 | } else { | 58 | } else { |
59 | cp = ip_vs_conn_in_get(IPPROTO_UDP, | 59 | cp = ip_vs_conn_in_get(IPPROTO_UDP, |
60 | iph->daddr, | 60 | iph->daddr, |
61 | __constant_htons(PORT_ISAKMP), | 61 | htons(PORT_ISAKMP), |
62 | iph->saddr, | 62 | iph->saddr, |
63 | __constant_htons(PORT_ISAKMP)); | 63 | htons(PORT_ISAKMP)); |
64 | } | 64 | } |
65 | 65 | ||
66 | if (!cp) { | 66 | if (!cp) { |
@@ -89,15 +89,15 @@ ah_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp, | |||
89 | if (likely(!inverse)) { | 89 | if (likely(!inverse)) { |
90 | cp = ip_vs_conn_out_get(IPPROTO_UDP, | 90 | cp = ip_vs_conn_out_get(IPPROTO_UDP, |
91 | iph->saddr, | 91 | iph->saddr, |
92 | __constant_htons(PORT_ISAKMP), | 92 | htons(PORT_ISAKMP), |
93 | iph->daddr, | 93 | iph->daddr, |
94 | __constant_htons(PORT_ISAKMP)); | 94 | htons(PORT_ISAKMP)); |
95 | } else { | 95 | } else { |
96 | cp = ip_vs_conn_out_get(IPPROTO_UDP, | 96 | cp = ip_vs_conn_out_get(IPPROTO_UDP, |
97 | iph->daddr, | 97 | iph->daddr, |
98 | __constant_htons(PORT_ISAKMP), | 98 | htons(PORT_ISAKMP), |
99 | iph->saddr, | 99 | iph->saddr, |
100 | __constant_htons(PORT_ISAKMP)); | 100 | htons(PORT_ISAKMP)); |
101 | } | 101 | } |
102 | 102 | ||
103 | if (!cp) { | 103 | if (!cp) { |
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c index e1f77bd7c9a5..f73c5acf5dd1 100644 --- a/net/ipv4/ipvs/ip_vs_xmit.c +++ b/net/ipv4/ipvs/ip_vs_xmit.c | |||
@@ -178,7 +178,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
178 | 178 | ||
179 | /* MTU checking */ | 179 | /* MTU checking */ |
180 | mtu = dst_mtu(&rt->u.dst); | 180 | mtu = dst_mtu(&rt->u.dst); |
181 | if ((skb->len > mtu) && (iph->frag_off&__constant_htons(IP_DF))) { | 181 | if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF))) { |
182 | ip_rt_put(rt); | 182 | ip_rt_put(rt); |
183 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); | 183 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); |
184 | IP_VS_DBG_RL("ip_vs_bypass_xmit(): frag needed\n"); | 184 | IP_VS_DBG_RL("ip_vs_bypass_xmit(): frag needed\n"); |
@@ -245,7 +245,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
245 | 245 | ||
246 | /* MTU checking */ | 246 | /* MTU checking */ |
247 | mtu = dst_mtu(&rt->u.dst); | 247 | mtu = dst_mtu(&rt->u.dst); |
248 | if ((skb->len > mtu) && (iph->frag_off&__constant_htons(IP_DF))) { | 248 | if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF))) { |
249 | ip_rt_put(rt); | 249 | ip_rt_put(rt); |
250 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); | 250 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); |
251 | IP_VS_DBG_RL_PKT(0, pp, skb, 0, "ip_vs_nat_xmit(): frag needed for"); | 251 | IP_VS_DBG_RL_PKT(0, pp, skb, 0, "ip_vs_nat_xmit(): frag needed for"); |
@@ -329,10 +329,10 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
329 | 329 | ||
330 | EnterFunction(10); | 330 | EnterFunction(10); |
331 | 331 | ||
332 | if (skb->protocol != __constant_htons(ETH_P_IP)) { | 332 | if (skb->protocol != htons(ETH_P_IP)) { |
333 | IP_VS_DBG_RL("ip_vs_tunnel_xmit(): protocol error, " | 333 | IP_VS_DBG_RL("ip_vs_tunnel_xmit(): protocol error, " |
334 | "ETH_P_IP: %d, skb protocol: %d\n", | 334 | "ETH_P_IP: %d, skb protocol: %d\n", |
335 | __constant_htons(ETH_P_IP), skb->protocol); | 335 | htons(ETH_P_IP), skb->protocol); |
336 | goto tx_error; | 336 | goto tx_error; |
337 | } | 337 | } |
338 | 338 | ||
@@ -350,9 +350,9 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
350 | if (skb->dst) | 350 | if (skb->dst) |
351 | skb->dst->ops->update_pmtu(skb->dst, mtu); | 351 | skb->dst->ops->update_pmtu(skb->dst, mtu); |
352 | 352 | ||
353 | df |= (old_iph->frag_off&__constant_htons(IP_DF)); | 353 | df |= (old_iph->frag_off & htons(IP_DF)); |
354 | 354 | ||
355 | if ((old_iph->frag_off&__constant_htons(IP_DF)) | 355 | if ((old_iph->frag_off & htons(IP_DF)) |
356 | && mtu < ntohs(old_iph->tot_len)) { | 356 | && mtu < ntohs(old_iph->tot_len)) { |
357 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); | 357 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); |
358 | ip_rt_put(rt); | 358 | ip_rt_put(rt); |
@@ -445,7 +445,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
445 | 445 | ||
446 | /* MTU checking */ | 446 | /* MTU checking */ |
447 | mtu = dst_mtu(&rt->u.dst); | 447 | mtu = dst_mtu(&rt->u.dst); |
448 | if ((iph->frag_off&__constant_htons(IP_DF)) && skb->len > mtu) { | 448 | if ((iph->frag_off & htons(IP_DF)) && skb->len > mtu) { |
449 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); | 449 | icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu)); |
450 | ip_rt_put(rt); | 450 | ip_rt_put(rt); |
451 | IP_VS_DBG_RL("ip_vs_dr_xmit(): frag needed\n"); | 451 | IP_VS_DBG_RL("ip_vs_dr_xmit(): frag needed\n"); |
@@ -519,7 +519,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, | |||
519 | 519 | ||
520 | /* MTU checking */ | 520 | /* MTU checking */ |
521 | mtu = dst_mtu(&rt->u.dst); | 521 | mtu = dst_mtu(&rt->u.dst); |
522 | if ((skb->len > mtu) && (skb->nh.iph->frag_off&__constant_htons(IP_DF))) { | 522 | if ((skb->len > mtu) && (skb->nh.iph->frag_off & htons(IP_DF))) { |
523 | ip_rt_put(rt); | 523 | ip_rt_put(rt); |
524 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); | 524 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); |
525 | IP_VS_DBG_RL("ip_vs_in_icmp(): frag needed\n"); | 525 | IP_VS_DBG_RL("ip_vs_in_icmp(): frag needed\n"); |
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 0a72eab14620..7ff11977eb4d 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c | |||
@@ -515,11 +515,10 @@ static void tcp_sack(const struct sk_buff *skb, | |||
515 | 515 | ||
516 | /* Fast path for timestamp-only option */ | 516 | /* Fast path for timestamp-only option */ |
517 | if (length == TCPOLEN_TSTAMP_ALIGNED*4 | 517 | if (length == TCPOLEN_TSTAMP_ALIGNED*4 |
518 | && *(__be32 *)ptr == | 518 | && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) |
519 | __constant_htonl((TCPOPT_NOP << 24) | 519 | | (TCPOPT_NOP << 16) |
520 | | (TCPOPT_NOP << 16) | 520 | | (TCPOPT_TIMESTAMP << 8) |
521 | | (TCPOPT_TIMESTAMP << 8) | 521 | | TCPOLEN_TIMESTAMP)) |
522 | | TCPOLEN_TIMESTAMP)) | ||
523 | return; | 522 | return; |
524 | 523 | ||
525 | while (length > 0) { | 524 | while (length > 0) { |