diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-03-21 01:57:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:57:46 -0500 |
commit | f8a26028611fb93ac935ac32a72793f7fcb56a88 (patch) | |
tree | 90c7d08c6f1ef47a1eeb108e0d566315061f9ffa /net/bridge | |
parent | 789bc3e5b66d3664f651f6c10a188c8e3e025037 (diff) |
[BRIDGE]: netfilter dont use __constant_htons
Only use__constant_htons() for initializers and switch cases.
For other uses, it is just as efficient and clearer to use htons
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_netfilter.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index cf18d0235ccb..ea34aa505af2 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -61,14 +61,14 @@ static int brnf_filter_vlan_tagged = 1; | |||
61 | #define brnf_filter_vlan_tagged 1 | 61 | #define brnf_filter_vlan_tagged 1 |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #define IS_VLAN_IP (skb->protocol == __constant_htons(ETH_P_8021Q) && \ | 64 | #define IS_VLAN_IP (skb->protocol == htons(ETH_P_8021Q) && \ |
65 | hdr->h_vlan_encapsulated_proto == __constant_htons(ETH_P_IP) && \ | 65 | hdr->h_vlan_encapsulated_proto == htons(ETH_P_IP) && \ |
66 | brnf_filter_vlan_tagged) | 66 | brnf_filter_vlan_tagged) |
67 | #define IS_VLAN_IPV6 (skb->protocol == __constant_htons(ETH_P_8021Q) && \ | 67 | #define IS_VLAN_IPV6 (skb->protocol == htons(ETH_P_8021Q) && \ |
68 | hdr->h_vlan_encapsulated_proto == __constant_htons(ETH_P_IPV6) && \ | 68 | hdr->h_vlan_encapsulated_proto == htons(ETH_P_IPV6) && \ |
69 | brnf_filter_vlan_tagged) | 69 | brnf_filter_vlan_tagged) |
70 | #define IS_VLAN_ARP (skb->protocol == __constant_htons(ETH_P_8021Q) && \ | 70 | #define IS_VLAN_ARP (skb->protocol == htons(ETH_P_8021Q) && \ |
71 | hdr->h_vlan_encapsulated_proto == __constant_htons(ETH_P_ARP) && \ | 71 | hdr->h_vlan_encapsulated_proto == htons(ETH_P_ARP) && \ |
72 | brnf_filter_vlan_tagged) | 72 | brnf_filter_vlan_tagged) |
73 | 73 | ||
74 | /* We need these fake structures to make netfilter happy -- | 74 | /* We need these fake structures to make netfilter happy -- |
@@ -120,7 +120,7 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb) | |||
120 | dst_hold(skb->dst); | 120 | dst_hold(skb->dst); |
121 | 121 | ||
122 | skb->dev = nf_bridge->physindev; | 122 | skb->dev = nf_bridge->physindev; |
123 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 123 | if (skb->protocol == htons(ETH_P_8021Q)) { |
124 | skb_push(skb, VLAN_HLEN); | 124 | skb_push(skb, VLAN_HLEN); |
125 | skb->nh.raw -= VLAN_HLEN; | 125 | skb->nh.raw -= VLAN_HLEN; |
126 | } | 126 | } |
@@ -196,7 +196,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) | |||
196 | if (!skb->dev) | 196 | if (!skb->dev) |
197 | kfree_skb(skb); | 197 | kfree_skb(skb); |
198 | else { | 198 | else { |
199 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 199 | if (skb->protocol == htons(ETH_P_8021Q)) { |
200 | skb_pull(skb, VLAN_HLEN); | 200 | skb_pull(skb, VLAN_HLEN); |
201 | skb->nh.raw += VLAN_HLEN; | 201 | skb->nh.raw += VLAN_HLEN; |
202 | } | 202 | } |
@@ -252,7 +252,7 @@ bridged_dnat: | |||
252 | nf_bridge->mask |= BRNF_BRIDGED_DNAT; | 252 | nf_bridge->mask |= BRNF_BRIDGED_DNAT; |
253 | skb->dev = nf_bridge->physindev; | 253 | skb->dev = nf_bridge->physindev; |
254 | if (skb->protocol == | 254 | if (skb->protocol == |
255 | __constant_htons(ETH_P_8021Q)) { | 255 | htons(ETH_P_8021Q)) { |
256 | skb_push(skb, VLAN_HLEN); | 256 | skb_push(skb, VLAN_HLEN); |
257 | skb->nh.raw -= VLAN_HLEN; | 257 | skb->nh.raw -= VLAN_HLEN; |
258 | } | 258 | } |
@@ -271,7 +271,7 @@ bridged_dnat: | |||
271 | } | 271 | } |
272 | 272 | ||
273 | skb->dev = nf_bridge->physindev; | 273 | skb->dev = nf_bridge->physindev; |
274 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 274 | if (skb->protocol == htons(ETH_P_8021Q)) { |
275 | skb_push(skb, VLAN_HLEN); | 275 | skb_push(skb, VLAN_HLEN); |
276 | skb->nh.raw -= VLAN_HLEN; | 276 | skb->nh.raw -= VLAN_HLEN; |
277 | } | 277 | } |
@@ -421,7 +421,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, | |||
421 | struct nf_bridge_info *nf_bridge; | 421 | struct nf_bridge_info *nf_bridge; |
422 | struct vlan_ethhdr *hdr = vlan_eth_hdr(*pskb); | 422 | struct vlan_ethhdr *hdr = vlan_eth_hdr(*pskb); |
423 | 423 | ||
424 | if (skb->protocol == __constant_htons(ETH_P_IPV6) || IS_VLAN_IPV6) { | 424 | if (skb->protocol == htons(ETH_P_IPV6) || IS_VLAN_IPV6) { |
425 | #ifdef CONFIG_SYSCTL | 425 | #ifdef CONFIG_SYSCTL |
426 | if (!brnf_call_ip6tables) | 426 | if (!brnf_call_ip6tables) |
427 | return NF_ACCEPT; | 427 | return NF_ACCEPT; |
@@ -429,7 +429,7 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, | |||
429 | if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL) | 429 | if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL) |
430 | goto out; | 430 | goto out; |
431 | 431 | ||
432 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 432 | if (skb->protocol == htons(ETH_P_8021Q)) { |
433 | skb_pull_rcsum(skb, VLAN_HLEN); | 433 | skb_pull_rcsum(skb, VLAN_HLEN); |
434 | skb->nh.raw += VLAN_HLEN; | 434 | skb->nh.raw += VLAN_HLEN; |
435 | } | 435 | } |
@@ -440,13 +440,13 @@ static unsigned int br_nf_pre_routing(unsigned int hook, struct sk_buff **pskb, | |||
440 | return NF_ACCEPT; | 440 | return NF_ACCEPT; |
441 | #endif | 441 | #endif |
442 | 442 | ||
443 | if (skb->protocol != __constant_htons(ETH_P_IP) && !IS_VLAN_IP) | 443 | if (skb->protocol != htons(ETH_P_IP) && !IS_VLAN_IP) |
444 | return NF_ACCEPT; | 444 | return NF_ACCEPT; |
445 | 445 | ||
446 | if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL) | 446 | if ((skb = skb_share_check(*pskb, GFP_ATOMIC)) == NULL) |
447 | goto out; | 447 | goto out; |
448 | 448 | ||
449 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 449 | if (skb->protocol == htons(ETH_P_8021Q)) { |
450 | skb_pull_rcsum(skb, VLAN_HLEN); | 450 | skb_pull_rcsum(skb, VLAN_HLEN); |
451 | skb->nh.raw += VLAN_HLEN; | 451 | skb->nh.raw += VLAN_HLEN; |
452 | } | 452 | } |
@@ -523,7 +523,7 @@ static int br_nf_forward_finish(struct sk_buff *skb) | |||
523 | struct net_device *in; | 523 | struct net_device *in; |
524 | struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); | 524 | struct vlan_ethhdr *hdr = vlan_eth_hdr(skb); |
525 | 525 | ||
526 | if (skb->protocol != __constant_htons(ETH_P_ARP) && !IS_VLAN_ARP) { | 526 | if (skb->protocol != htons(ETH_P_ARP) && !IS_VLAN_ARP) { |
527 | in = nf_bridge->physindev; | 527 | in = nf_bridge->physindev; |
528 | if (nf_bridge->mask & BRNF_PKT_TYPE) { | 528 | if (nf_bridge->mask & BRNF_PKT_TYPE) { |
529 | skb->pkt_type = PACKET_OTHERHOST; | 529 | skb->pkt_type = PACKET_OTHERHOST; |
@@ -532,7 +532,7 @@ static int br_nf_forward_finish(struct sk_buff *skb) | |||
532 | } else { | 532 | } else { |
533 | in = *((struct net_device **)(skb->cb)); | 533 | in = *((struct net_device **)(skb->cb)); |
534 | } | 534 | } |
535 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 535 | if (skb->protocol == htons(ETH_P_8021Q)) { |
536 | skb_push(skb, VLAN_HLEN); | 536 | skb_push(skb, VLAN_HLEN); |
537 | skb->nh.raw -= VLAN_HLEN; | 537 | skb->nh.raw -= VLAN_HLEN; |
538 | } | 538 | } |
@@ -564,12 +564,12 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff **pskb, | |||
564 | if (!parent) | 564 | if (!parent) |
565 | return NF_DROP; | 565 | return NF_DROP; |
566 | 566 | ||
567 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) | 567 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP) |
568 | pf = PF_INET; | 568 | pf = PF_INET; |
569 | else | 569 | else |
570 | pf = PF_INET6; | 570 | pf = PF_INET6; |
571 | 571 | ||
572 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 572 | if (skb->protocol == htons(ETH_P_8021Q)) { |
573 | skb_pull(*pskb, VLAN_HLEN); | 573 | skb_pull(*pskb, VLAN_HLEN); |
574 | (*pskb)->nh.raw += VLAN_HLEN; | 574 | (*pskb)->nh.raw += VLAN_HLEN; |
575 | } | 575 | } |
@@ -604,7 +604,7 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff **pskb, | |||
604 | return NF_ACCEPT; | 604 | return NF_ACCEPT; |
605 | #endif | 605 | #endif |
606 | 606 | ||
607 | if (skb->protocol != __constant_htons(ETH_P_ARP)) { | 607 | if (skb->protocol != htons(ETH_P_ARP)) { |
608 | if (!IS_VLAN_ARP) | 608 | if (!IS_VLAN_ARP) |
609 | return NF_ACCEPT; | 609 | return NF_ACCEPT; |
610 | skb_pull(*pskb, VLAN_HLEN); | 610 | skb_pull(*pskb, VLAN_HLEN); |
@@ -628,7 +628,7 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff **pskb, | |||
628 | /* PF_BRIDGE/LOCAL_OUT ***********************************************/ | 628 | /* PF_BRIDGE/LOCAL_OUT ***********************************************/ |
629 | static int br_nf_local_out_finish(struct sk_buff *skb) | 629 | static int br_nf_local_out_finish(struct sk_buff *skb) |
630 | { | 630 | { |
631 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 631 | if (skb->protocol == htons(ETH_P_8021Q)) { |
632 | skb_push(skb, VLAN_HLEN); | 632 | skb_push(skb, VLAN_HLEN); |
633 | skb->nh.raw -= VLAN_HLEN; | 633 | skb->nh.raw -= VLAN_HLEN; |
634 | } | 634 | } |
@@ -673,7 +673,7 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, | |||
673 | if (!skb->nf_bridge) | 673 | if (!skb->nf_bridge) |
674 | return NF_ACCEPT; | 674 | return NF_ACCEPT; |
675 | 675 | ||
676 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) | 676 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP) |
677 | pf = PF_INET; | 677 | pf = PF_INET; |
678 | else | 678 | else |
679 | pf = PF_INET6; | 679 | pf = PF_INET6; |
@@ -699,7 +699,7 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, | |||
699 | skb->pkt_type = PACKET_OTHERHOST; | 699 | skb->pkt_type = PACKET_OTHERHOST; |
700 | nf_bridge->mask ^= BRNF_PKT_TYPE; | 700 | nf_bridge->mask ^= BRNF_PKT_TYPE; |
701 | } | 701 | } |
702 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 702 | if (skb->protocol == htons(ETH_P_8021Q)) { |
703 | skb_push(skb, VLAN_HLEN); | 703 | skb_push(skb, VLAN_HLEN); |
704 | skb->nh.raw -= VLAN_HLEN; | 704 | skb->nh.raw -= VLAN_HLEN; |
705 | } | 705 | } |
@@ -717,7 +717,7 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, | |||
717 | if (nf_bridge->netoutdev) | 717 | if (nf_bridge->netoutdev) |
718 | realoutdev = nf_bridge->netoutdev; | 718 | realoutdev = nf_bridge->netoutdev; |
719 | #endif | 719 | #endif |
720 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 720 | if (skb->protocol == htons(ETH_P_8021Q)) { |
721 | skb_pull(skb, VLAN_HLEN); | 721 | skb_pull(skb, VLAN_HLEN); |
722 | (*pskb)->nh.raw += VLAN_HLEN; | 722 | (*pskb)->nh.raw += VLAN_HLEN; |
723 | } | 723 | } |
@@ -772,7 +772,7 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, | |||
772 | if (!realoutdev) | 772 | if (!realoutdev) |
773 | return NF_DROP; | 773 | return NF_DROP; |
774 | 774 | ||
775 | if (skb->protocol == __constant_htons(ETH_P_IP) || IS_VLAN_IP) | 775 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP) |
776 | pf = PF_INET; | 776 | pf = PF_INET; |
777 | else | 777 | else |
778 | pf = PF_INET6; | 778 | pf = PF_INET6; |
@@ -791,7 +791,7 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, | |||
791 | nf_bridge->mask |= BRNF_PKT_TYPE; | 791 | nf_bridge->mask |= BRNF_PKT_TYPE; |
792 | } | 792 | } |
793 | 793 | ||
794 | if (skb->protocol == __constant_htons(ETH_P_8021Q)) { | 794 | if (skb->protocol == htons(ETH_P_8021Q)) { |
795 | skb_pull(skb, VLAN_HLEN); | 795 | skb_pull(skb, VLAN_HLEN); |
796 | skb->nh.raw += VLAN_HLEN; | 796 | skb->nh.raw += VLAN_HLEN; |
797 | } | 797 | } |