Skip to content

Commit 05e3aa0

Browse files
committed
net: Create and use new helper, neigh_output().
Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a292829 commit 05e3aa0

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎include/net/neighbour.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
344344
return hh->hh_output(skb);
345345
}
346346

347+
static inline int neigh_output(struct neighbour *n, struct sk_buff *skb)
348+
{
349+
struct hh_cache *hh = &n->hh;
350+
if (hh->hh_len)
351+
return neigh_hh_output(hh, skb);
352+
else
353+
return n->output(skb);
354+
}
355+
347356
static inline struct neighbour *
348357
__neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat)
349358
{

‎net/ipv4/ip_output.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,9 @@ static inline int ip_finish_output2(struct sk_buff *skb)
205205
}
206206

207207
neigh = dst->neighbour;
208-
if (neigh) {
209-
struct hh_cache *hh = &neigh->hh;
210-
if (hh->hh_len)
211-
return neigh_hh_output(hh, skb);
212-
else
213-
return neigh->output(skb);
214-
}
208+
if (neigh)
209+
return neigh_output(neigh, skb);
210+
215211
if (net_ratelimit())
216212
printk(KERN_DEBUG "ip_finish_output2: No header cache and no neighbour!\n");
217213
kfree_skb(skb);

‎net/ipv6/ip6_output.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,9 @@ static int ip6_finish_output2(struct sk_buff *skb)
136136
}
137137

138138
neigh = dst->neighbour;
139-
if (neigh) {
140-
struct hh_cache *hh = &neigh->hh;
141-
if (hh->hh_len)
142-
return neigh_hh_output(hh, skb);
143-
else
144-
return neigh->output(skb);
145-
}
139+
if (neigh)
140+
return neigh_output(neigh, skb);
141+
146142
IP6_INC_STATS_BH(dev_net(dst->dev),
147143
ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
148144
kfree_skb(skb);

0 commit comments

Comments
 (0)