mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
[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>
This commit is contained in:
parent
1c9e8ef7f7
commit
4412ec4948
@ -617,7 +617,7 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related)
|
|||||||
*related = 1;
|
*related = 1;
|
||||||
|
|
||||||
/* reassemble IP fragments */
|
/* reassemble IP fragments */
|
||||||
if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) {
|
if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
|
||||||
skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
|
skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
return NF_STOLEN;
|
return NF_STOLEN;
|
||||||
@ -659,7 +659,7 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related)
|
|||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
|
||||||
/* Is the embedded protocol header present? */
|
/* Is the embedded protocol header present? */
|
||||||
if (unlikely(cih->frag_off & __constant_htons(IP_OFFSET) &&
|
if (unlikely(cih->frag_off & htons(IP_OFFSET) &&
|
||||||
pp->dont_defrag))
|
pp->dont_defrag))
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
|
|||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
|
||||||
/* reassemble IP fragments */
|
/* reassemble IP fragments */
|
||||||
if (unlikely(iph->frag_off & __constant_htons(IP_MF|IP_OFFSET) &&
|
if (unlikely(iph->frag_off & htons(IP_MF|IP_OFFSET) &&
|
||||||
!pp->dont_defrag)) {
|
!pp->dont_defrag)) {
|
||||||
skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
|
skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
@ -861,7 +861,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)
|
|||||||
*related = 1;
|
*related = 1;
|
||||||
|
|
||||||
/* reassemble IP fragments */
|
/* reassemble IP fragments */
|
||||||
if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) {
|
if (skb->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
|
||||||
skb = ip_vs_gather_frags(skb,
|
skb = ip_vs_gather_frags(skb,
|
||||||
hooknum == NF_IP_LOCAL_IN ?
|
hooknum == NF_IP_LOCAL_IN ?
|
||||||
IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD);
|
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)
|
|||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
|
||||||
/* Is the embedded protocol header present? */
|
/* Is the embedded protocol header present? */
|
||||||
if (unlikely(cih->frag_off & __constant_htons(IP_OFFSET) &&
|
if (unlikely(cih->frag_off & htons(IP_OFFSET) &&
|
||||||
pp->dont_defrag))
|
pp->dont_defrag))
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
|
||||||
|
@ -52,15 +52,15 @@ ah_conn_in_get(const struct sk_buff *skb,
|
|||||||
if (likely(!inverse)) {
|
if (likely(!inverse)) {
|
||||||
cp = ip_vs_conn_in_get(IPPROTO_UDP,
|
cp = ip_vs_conn_in_get(IPPROTO_UDP,
|
||||||
iph->saddr,
|
iph->saddr,
|
||||||
__constant_htons(PORT_ISAKMP),
|
htons(PORT_ISAKMP),
|
||||||
iph->daddr,
|
iph->daddr,
|
||||||
__constant_htons(PORT_ISAKMP));
|
htons(PORT_ISAKMP));
|
||||||
} else {
|
} else {
|
||||||
cp = ip_vs_conn_in_get(IPPROTO_UDP,
|
cp = ip_vs_conn_in_get(IPPROTO_UDP,
|
||||||
iph->daddr,
|
iph->daddr,
|
||||||
__constant_htons(PORT_ISAKMP),
|
htons(PORT_ISAKMP),
|
||||||
iph->saddr,
|
iph->saddr,
|
||||||
__constant_htons(PORT_ISAKMP));
|
htons(PORT_ISAKMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cp) {
|
if (!cp) {
|
||||||
@ -89,15 +89,15 @@ ah_conn_out_get(const struct sk_buff *skb, struct ip_vs_protocol *pp,
|
|||||||
if (likely(!inverse)) {
|
if (likely(!inverse)) {
|
||||||
cp = ip_vs_conn_out_get(IPPROTO_UDP,
|
cp = ip_vs_conn_out_get(IPPROTO_UDP,
|
||||||
iph->saddr,
|
iph->saddr,
|
||||||
__constant_htons(PORT_ISAKMP),
|
htons(PORT_ISAKMP),
|
||||||
iph->daddr,
|
iph->daddr,
|
||||||
__constant_htons(PORT_ISAKMP));
|
htons(PORT_ISAKMP));
|
||||||
} else {
|
} else {
|
||||||
cp = ip_vs_conn_out_get(IPPROTO_UDP,
|
cp = ip_vs_conn_out_get(IPPROTO_UDP,
|
||||||
iph->daddr,
|
iph->daddr,
|
||||||
__constant_htons(PORT_ISAKMP),
|
htons(PORT_ISAKMP),
|
||||||
iph->saddr,
|
iph->saddr,
|
||||||
__constant_htons(PORT_ISAKMP));
|
htons(PORT_ISAKMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cp) {
|
if (!cp) {
|
||||||
|
@ -178,7 +178,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
|
|||||||
|
|
||||||
/* MTU checking */
|
/* MTU checking */
|
||||||
mtu = dst_mtu(&rt->u.dst);
|
mtu = dst_mtu(&rt->u.dst);
|
||||||
if ((skb->len > mtu) && (iph->frag_off&__constant_htons(IP_DF))) {
|
if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF))) {
|
||||||
ip_rt_put(rt);
|
ip_rt_put(rt);
|
||||||
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
||||||
IP_VS_DBG_RL("ip_vs_bypass_xmit(): frag needed\n");
|
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,
|
|||||||
|
|
||||||
/* MTU checking */
|
/* MTU checking */
|
||||||
mtu = dst_mtu(&rt->u.dst);
|
mtu = dst_mtu(&rt->u.dst);
|
||||||
if ((skb->len > mtu) && (iph->frag_off&__constant_htons(IP_DF))) {
|
if ((skb->len > mtu) && (iph->frag_off & htons(IP_DF))) {
|
||||||
ip_rt_put(rt);
|
ip_rt_put(rt);
|
||||||
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
||||||
IP_VS_DBG_RL_PKT(0, pp, skb, 0, "ip_vs_nat_xmit(): frag needed for");
|
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,
|
|||||||
|
|
||||||
EnterFunction(10);
|
EnterFunction(10);
|
||||||
|
|
||||||
if (skb->protocol != __constant_htons(ETH_P_IP)) {
|
if (skb->protocol != htons(ETH_P_IP)) {
|
||||||
IP_VS_DBG_RL("ip_vs_tunnel_xmit(): protocol error, "
|
IP_VS_DBG_RL("ip_vs_tunnel_xmit(): protocol error, "
|
||||||
"ETH_P_IP: %d, skb protocol: %d\n",
|
"ETH_P_IP: %d, skb protocol: %d\n",
|
||||||
__constant_htons(ETH_P_IP), skb->protocol);
|
htons(ETH_P_IP), skb->protocol);
|
||||||
goto tx_error;
|
goto tx_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,9 +350,9 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
|
|||||||
if (skb->dst)
|
if (skb->dst)
|
||||||
skb->dst->ops->update_pmtu(skb->dst, mtu);
|
skb->dst->ops->update_pmtu(skb->dst, mtu);
|
||||||
|
|
||||||
df |= (old_iph->frag_off&__constant_htons(IP_DF));
|
df |= (old_iph->frag_off & htons(IP_DF));
|
||||||
|
|
||||||
if ((old_iph->frag_off&__constant_htons(IP_DF))
|
if ((old_iph->frag_off & htons(IP_DF))
|
||||||
&& mtu < ntohs(old_iph->tot_len)) {
|
&& mtu < ntohs(old_iph->tot_len)) {
|
||||||
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
||||||
ip_rt_put(rt);
|
ip_rt_put(rt);
|
||||||
@ -445,7 +445,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
|
|||||||
|
|
||||||
/* MTU checking */
|
/* MTU checking */
|
||||||
mtu = dst_mtu(&rt->u.dst);
|
mtu = dst_mtu(&rt->u.dst);
|
||||||
if ((iph->frag_off&__constant_htons(IP_DF)) && skb->len > mtu) {
|
if ((iph->frag_off & htons(IP_DF)) && skb->len > mtu) {
|
||||||
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
icmp_send(skb, ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED, htonl(mtu));
|
||||||
ip_rt_put(rt);
|
ip_rt_put(rt);
|
||||||
IP_VS_DBG_RL("ip_vs_dr_xmit(): frag needed\n");
|
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,
|
|||||||
|
|
||||||
/* MTU checking */
|
/* MTU checking */
|
||||||
mtu = dst_mtu(&rt->u.dst);
|
mtu = dst_mtu(&rt->u.dst);
|
||||||
if ((skb->len > mtu) && (skb->nh.iph->frag_off&__constant_htons(IP_DF))) {
|
if ((skb->len > mtu) && (skb->nh.iph->frag_off & htons(IP_DF))) {
|
||||||
ip_rt_put(rt);
|
ip_rt_put(rt);
|
||||||
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
|
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
|
||||||
IP_VS_DBG_RL("ip_vs_in_icmp(): frag needed\n");
|
IP_VS_DBG_RL("ip_vs_in_icmp(): frag needed\n");
|
||||||
|
@ -515,11 +515,10 @@ static void tcp_sack(const struct sk_buff *skb,
|
|||||||
|
|
||||||
/* Fast path for timestamp-only option */
|
/* Fast path for timestamp-only option */
|
||||||
if (length == TCPOLEN_TSTAMP_ALIGNED*4
|
if (length == TCPOLEN_TSTAMP_ALIGNED*4
|
||||||
&& *(__be32 *)ptr ==
|
&& *(__be32 *)ptr == htonl((TCPOPT_NOP << 24)
|
||||||
__constant_htonl((TCPOPT_NOP << 24)
|
| (TCPOPT_NOP << 16)
|
||||||
| (TCPOPT_NOP << 16)
|
| (TCPOPT_TIMESTAMP << 8)
|
||||||
| (TCPOPT_TIMESTAMP << 8)
|
| TCPOLEN_TIMESTAMP))
|
||||||
| TCPOLEN_TIMESTAMP))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user