aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-11-14 00:34:06 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:53:37 -0500
commit352e512c32b634768303a43768245a0363cebbe7 (patch)
tree97509ac130ecbe2084808271ccc459918a9d5fc1 /net/ipv6/route.c
parentb4ce92775c2e7ff9cf79cca4e0a19c8c5fd6287b (diff)
[NET]: Eliminate duplicate copies of dst_discard
We have a number of copies of dst_discard scattered around the place which all do the same thing, namely free a packet on the input or output paths. This patch deletes all of them except dst_discard and points all the users to it. The only non-trivial bit is decnet where it returns an error. However, conceptually this is identical to the blackhole functions used in IPv4 and IPv6 which do not return errors. So they should either all return errors or all return zero. For now I've stuck with the majority and picked zero as the return value. It doesn't really matter in practice since few if any driver would react differently depending on a zero return value or NET_RX_DROP. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 20083e0d3995..ac70e2d3b10c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -152,7 +152,6 @@ struct rt6_info ip6_null_entry = {
152 152
153static int ip6_pkt_prohibit(struct sk_buff *skb); 153static int ip6_pkt_prohibit(struct sk_buff *skb);
154static int ip6_pkt_prohibit_out(struct sk_buff *skb); 154static int ip6_pkt_prohibit_out(struct sk_buff *skb);
155static int ip6_pkt_blk_hole(struct sk_buff *skb);
156 155
157struct rt6_info ip6_prohibit_entry = { 156struct rt6_info ip6_prohibit_entry = {
158 .u = { 157 .u = {
@@ -181,8 +180,8 @@ struct rt6_info ip6_blk_hole_entry = {
181 .obsolete = -1, 180 .obsolete = -1,
182 .error = -EINVAL, 181 .error = -EINVAL,
183 .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, 182 .metrics = { [RTAX_HOPLIMIT - 1] = 255, },
184 .input = ip6_pkt_blk_hole, 183 .input = dst_discard,
185 .output = ip6_pkt_blk_hole, 184 .output = dst_discard,
186 .ops = &ip6_dst_ops, 185 .ops = &ip6_dst_ops,
187 .path = (struct dst_entry*)&ip6_blk_hole_entry, 186 .path = (struct dst_entry*)&ip6_blk_hole_entry,
188 } 187 }
@@ -782,12 +781,6 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
782 781
783EXPORT_SYMBOL(ip6_route_output); 782EXPORT_SYMBOL(ip6_route_output);
784 783
785static int ip6_blackhole_output(struct sk_buff *skb)
786{
787 kfree_skb(skb);
788 return 0;
789}
790
791int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl) 784int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl)
792{ 785{
793 struct rt6_info *ort = (struct rt6_info *) *dstp; 786 struct rt6_info *ort = (struct rt6_info *) *dstp;
@@ -800,8 +793,8 @@ int ip6_dst_blackhole(struct sock *sk, struct dst_entry **dstp, struct flowi *fl
800 793
801 atomic_set(&new->__refcnt, 1); 794 atomic_set(&new->__refcnt, 1);
802 new->__use = 1; 795 new->__use = 1;
803 new->input = ip6_blackhole_output; 796 new->input = dst_discard;
804 new->output = ip6_blackhole_output; 797 new->output = dst_discard;
805 798
806 memcpy(new->metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32)); 799 memcpy(new->metrics, ort->u.dst.metrics, RTAX_MAX*sizeof(u32));
807 new->dev = ort->u.dst.dev; 800 new->dev = ort->u.dst.dev;
@@ -1811,12 +1804,6 @@ static int ip6_pkt_prohibit_out(struct sk_buff *skb)
1811 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); 1804 return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
1812} 1805}
1813 1806
1814static int ip6_pkt_blk_hole(struct sk_buff *skb)
1815{
1816 kfree_skb(skb);
1817 return 0;
1818}
1819
1820#endif 1807#endif
1821 1808
1822/* 1809/*