提交 27217455 编写于 作者: D David Miller 提交者: David S. Miller

net: Rename dst_get_neighbour{, _raw} to dst_get_neighbour_noref{, _raw}.

To reflect the fact that a refrence is not obtained to the
resulting neighbour entry.
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Acked-by: NRoland Dreier <roland@purestorage.com>
上级 761965ea
...@@ -217,7 +217,7 @@ static int addr4_resolve(struct sockaddr_in *src_in, ...@@ -217,7 +217,7 @@ static int addr4_resolve(struct sockaddr_in *src_in,
neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev); neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev);
if (!neigh || !(neigh->nud_state & NUD_VALID)) { if (!neigh || !(neigh->nud_state & NUD_VALID)) {
rcu_read_lock(); rcu_read_lock();
neigh_event_send(dst_get_neighbour(&rt->dst), NULL); neigh_event_send(dst_get_neighbour_noref(&rt->dst), NULL);
rcu_read_unlock(); rcu_read_unlock();
ret = -ENODATA; ret = -ENODATA;
if (neigh) if (neigh)
...@@ -277,7 +277,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, ...@@ -277,7 +277,7 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
} }
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
if (!neigh || !(neigh->nud_state & NUD_VALID)) { if (!neigh || !(neigh->nud_state & NUD_VALID)) {
if (neigh) if (neigh)
neigh_event_send(neigh, NULL); neigh_event_send(neigh, NULL);
......
...@@ -1376,7 +1376,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) ...@@ -1376,7 +1376,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
} }
dst = &rt->dst; dst = &rt->dst;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
l2t = t3_l2t_get(tdev, neigh, neigh->dev); l2t = t3_l2t_get(tdev, neigh, neigh->dev);
rcu_read_unlock(); rcu_read_unlock();
if (!l2t) { if (!l2t) {
...@@ -1949,7 +1949,7 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -1949,7 +1949,7 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
ep->dst = &rt->dst; ep->dst = &rt->dst;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(ep->dst); neigh = dst_get_neighbour_noref(ep->dst);
/* get a l2t entry */ /* get a l2t entry */
ep->l2t = t3_l2t_get(ep->com.tdev, neigh, neigh->dev); ep->l2t = t3_l2t_get(ep->com.tdev, neigh, neigh->dev);
......
...@@ -1597,7 +1597,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -1597,7 +1597,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
} }
dst = &rt->dst; dst = &rt->dst;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
if (neigh->dev->flags & IFF_LOOPBACK) { if (neigh->dev->flags & IFF_LOOPBACK) {
pdev = ip_dev_find(&init_net, peer_ip); pdev = ip_dev_find(&init_net, peer_ip);
BUG_ON(!pdev); BUG_ON(!pdev);
...@@ -1825,7 +1825,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep) ...@@ -1825,7 +1825,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
ep->dst = &rt->dst; ep->dst = &rt->dst;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(ep->dst); neigh = dst_get_neighbour_noref(ep->dst);
/* get a l2t entry */ /* get a l2t entry */
if (neigh->dev->flags & IFF_LOOPBACK) { if (neigh->dev->flags & IFF_LOOPBACK) {
...@@ -2308,7 +2308,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) ...@@ -2308,7 +2308,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
ep->dst = &rt->dst; ep->dst = &rt->dst;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(ep->dst); neigh = dst_get_neighbour_noref(ep->dst);
/* get a l2t entry */ /* get a l2t entry */
if (neigh->dev->flags & IFF_LOOPBACK) { if (neigh->dev->flags & IFF_LOOPBACK) {
......
...@@ -1379,7 +1379,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi ...@@ -1379,7 +1379,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) { if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) {
rcu_read_lock(); rcu_read_lock();
neigh_event_send(dst_get_neighbour(&rt->dst), NULL); neigh_event_send(dst_get_neighbour_noref(&rt->dst), NULL);
rcu_read_unlock(); rcu_read_unlock();
} }
ip_rt_put(rt); ip_rt_put(rt);
......
...@@ -564,7 +564,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) ...@@ -564,7 +564,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
struct neighbour *n; struct neighbour *n;
unsigned long flags; unsigned long flags;
n = dst_get_neighbour(skb_dst(skb)); n = dst_get_neighbour_noref(skb_dst(skb));
neigh = ipoib_neigh_alloc(n, skb->dev); neigh = ipoib_neigh_alloc(n, skb->dev);
if (!neigh) { if (!neigh) {
++dev->stats.tx_dropped; ++dev->stats.tx_dropped;
...@@ -645,7 +645,7 @@ static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev) ...@@ -645,7 +645,7 @@ static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
struct neighbour *n; struct neighbour *n;
/* Look up path record for unicasts */ /* Look up path record for unicasts */
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
if (n->ha[4] != 0xff) { if (n->ha[4] != 0xff) {
neigh_add_path(skb, dev); neigh_add_path(skb, dev);
return; return;
...@@ -724,7 +724,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -724,7 +724,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
rcu_read_lock(); rcu_read_lock();
if (likely(skb_dst(skb))) if (likely(skb_dst(skb)))
n = dst_get_neighbour(skb_dst(skb)); n = dst_get_neighbour_noref(skb_dst(skb));
if (likely(n)) { if (likely(n)) {
if (unlikely(!*to_ipoib_neigh(n))) { if (unlikely(!*to_ipoib_neigh(n))) {
...@@ -841,7 +841,7 @@ static int ipoib_hard_header(struct sk_buff *skb, ...@@ -841,7 +841,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
dst = skb_dst(skb); dst = skb_dst(skb);
n = NULL; n = NULL;
if (dst) if (dst)
n = dst_get_neighbour_raw(dst); n = dst_get_neighbour_noref_raw(dst);
if ((!dst || !n) && daddr) { if ((!dst || !n) && daddr) {
struct ipoib_pseudoheader *phdr = struct ipoib_pseudoheader *phdr =
(struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
......
...@@ -269,7 +269,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, ...@@ -269,7 +269,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
skb->dev = dev; skb->dev = dev;
if (dst) if (dst)
n = dst_get_neighbour_raw(dst); n = dst_get_neighbour_noref_raw(dst);
if (!dst || !n) { if (!dst || !n) {
/* put pseudoheader back on for next time */ /* put pseudoheader back on for next time */
skb_push(skb, sizeof (struct ipoib_pseudoheader)); skb_push(skb, sizeof (struct ipoib_pseudoheader));
...@@ -728,7 +728,7 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb) ...@@ -728,7 +728,7 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb)
rcu_read_lock(); rcu_read_lock();
if (dst) if (dst)
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
if (n && !*to_ipoib_neigh(n)) { if (n && !*to_ipoib_neigh(n)) {
struct ipoib_neigh *neigh = ipoib_neigh_alloc(n, struct ipoib_neigh *neigh = ipoib_neigh_alloc(n,
skb->dev); skb->dev);
......
...@@ -969,7 +969,7 @@ static int nb_callback(struct notifier_block *self, unsigned long event, ...@@ -969,7 +969,7 @@ static int nb_callback(struct notifier_block *self, unsigned long event,
case (NETEVENT_REDIRECT):{ case (NETEVENT_REDIRECT):{
struct netevent_redirect *nr = ctx; struct netevent_redirect *nr = ctx;
cxgb_redirect(nr->old, nr->new); cxgb_redirect(nr->old, nr->new);
cxgb_neigh_update(dst_get_neighbour(nr->new)); cxgb_neigh_update(dst_get_neighbour_noref(nr->new));
break; break;
} }
default: default:
...@@ -1114,8 +1114,8 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) ...@@ -1114,8 +1114,8 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
struct l2t_entry *e; struct l2t_entry *e;
struct t3c_tid_entry *te; struct t3c_tid_entry *te;
olddev = dst_get_neighbour(old)->dev; olddev = dst_get_neighbour_noref(old)->dev;
newdev = dst_get_neighbour(new)->dev; newdev = dst_get_neighbour_noref(new)->dev;
if (!is_offloading(olddev)) if (!is_offloading(olddev))
return; return;
if (!is_offloading(newdev)) { if (!is_offloading(newdev)) {
...@@ -1132,7 +1132,7 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) ...@@ -1132,7 +1132,7 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
} }
/* Add new L2T entry */ /* Add new L2T entry */
e = t3_l2t_get(tdev, dst_get_neighbour(new), newdev); e = t3_l2t_get(tdev, dst_get_neighbour_noref(new), newdev);
if (!e) { if (!e) {
printk(KERN_ERR "%s: couldn't allocate new l2t entry!\n", printk(KERN_ERR "%s: couldn't allocate new l2t entry!\n",
__func__); __func__);
......
...@@ -2759,7 +2759,7 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) ...@@ -2759,7 +2759,7 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb)
rcu_read_lock(); rcu_read_lock();
dst = skb_dst(skb); dst = skb_dst(skb);
if (dst) if (dst)
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
if (n) { if (n) {
cast_type = n->type; cast_type = n->type;
rcu_read_unlock(); rcu_read_unlock();
...@@ -2855,7 +2855,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, ...@@ -2855,7 +2855,7 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
rcu_read_lock(); rcu_read_lock();
dst = skb_dst(skb); dst = skb_dst(skb);
if (dst) if (dst)
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
if (ipv == 4) { if (ipv == 4) {
/* IPv4 */ /* IPv4 */
hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type); hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
......
...@@ -966,7 +966,7 @@ static int init_act_open(struct cxgbi_sock *csk) ...@@ -966,7 +966,7 @@ static int init_act_open(struct cxgbi_sock *csk)
csk->saddr.sin_addr.s_addr = chba->ipv4addr; csk->saddr.sin_addr.s_addr = chba->ipv4addr;
csk->rss_qid = 0; csk->rss_qid = 0;
csk->l2t = t3_l2t_get(t3dev, dst_get_neighbour(dst), ndev); csk->l2t = t3_l2t_get(t3dev, dst_get_neighbour_noref(dst), ndev);
if (!csk->l2t) { if (!csk->l2t) {
pr_err("NO l2t available.\n"); pr_err("NO l2t available.\n");
return -EINVAL; return -EINVAL;
......
...@@ -1141,7 +1141,7 @@ static int init_act_open(struct cxgbi_sock *csk) ...@@ -1141,7 +1141,7 @@ static int init_act_open(struct cxgbi_sock *csk)
cxgbi_sock_set_flag(csk, CTPF_HAS_ATID); cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
cxgbi_sock_get(csk); cxgbi_sock_get(csk);
csk->l2t = cxgb4_l2t_get(lldi->l2t, dst_get_neighbour(csk->dst), ndev, 0); csk->l2t = cxgb4_l2t_get(lldi->l2t, dst_get_neighbour_noref(csk->dst), ndev, 0);
if (!csk->l2t) { if (!csk->l2t) {
pr_err("%s, cannot alloc l2t.\n", ndev->name); pr_err("%s, cannot alloc l2t.\n", ndev->name);
goto rel_resource; goto rel_resource;
......
...@@ -493,7 +493,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) ...@@ -493,7 +493,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
goto err_out; goto err_out;
} }
dst = &rt->dst; dst = &rt->dst;
ndev = dst_get_neighbour(dst)->dev; ndev = dst_get_neighbour_noref(dst)->dev;
if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) {
pr_info("multi-cast route %pI4, port %u, dev %s.\n", pr_info("multi-cast route %pI4, port %u, dev %s.\n",
...@@ -507,7 +507,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr) ...@@ -507,7 +507,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr); ndev = ip_dev_find(&init_net, daddr->sin_addr.s_addr);
mtu = ndev->mtu; mtu = ndev->mtu;
pr_info("rt dev %s, loopback -> %s, mtu %u.\n", pr_info("rt dev %s, loopback -> %s, mtu %u.\n",
dst_get_neighbour(dst)->dev->name, ndev->name, mtu); dst_get_neighbour_noref(dst)->dev->name, ndev->name, mtu);
} }
cdev = cxgbi_device_find_by_netdev(ndev, &port); cdev = cxgbi_device_find_by_netdev(ndev, &port);
......
...@@ -86,12 +86,12 @@ struct dst_entry { ...@@ -86,12 +86,12 @@ struct dst_entry {
}; };
}; };
static inline struct neighbour *dst_get_neighbour(struct dst_entry *dst) static inline struct neighbour *dst_get_neighbour_noref(struct dst_entry *dst)
{ {
return rcu_dereference(dst->_neighbour); return rcu_dereference(dst->_neighbour);
} }
static inline struct neighbour *dst_get_neighbour_raw(struct dst_entry *dst) static inline struct neighbour *dst_get_neighbour_noref_raw(struct dst_entry *dst)
{ {
return rcu_dereference_raw(dst->_neighbour); return rcu_dereference_raw(dst->_neighbour);
} }
...@@ -392,7 +392,7 @@ static inline void dst_confirm(struct dst_entry *dst) ...@@ -392,7 +392,7 @@ static inline void dst_confirm(struct dst_entry *dst)
struct neighbour *n; struct neighbour *n;
rcu_read_lock(); rcu_read_lock();
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
neigh_confirm(n); neigh_confirm(n);
rcu_read_unlock(); rcu_read_unlock();
} }
......
...@@ -338,7 +338,7 @@ static netdev_tx_t clip_start_xmit(struct sk_buff *skb, ...@@ -338,7 +338,7 @@ static netdev_tx_t clip_start_xmit(struct sk_buff *skb,
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
if (!n) { if (!n) {
pr_err("NO NEIGHBOUR !\n"); pr_err("NO NEIGHBOUR !\n");
dev_kfree_skb(skb); dev_kfree_skb(skb);
......
...@@ -356,7 +356,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb) ...@@ -356,7 +356,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
if (!skb->dev) if (!skb->dev)
goto free_skb; goto free_skb;
dst = skb_dst(skb); dst = skb_dst(skb);
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
if (neigh->hh.hh_len) { if (neigh->hh.hh_len) {
neigh_hh_bridge(&neigh->hh, skb); neigh_hh_bridge(&neigh->hh, skb);
skb->dev = nf_bridge->physindev; skb->dev = nf_bridge->physindev;
......
...@@ -366,7 +366,7 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev, ...@@ -366,7 +366,7 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
dev_hold(dst->dev); dev_hold(dst->dev);
dev_put(dev); dev_put(dev);
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
if (neigh && neigh->dev == dev) { if (neigh && neigh->dev == dev) {
neigh->dev = dst->dev; neigh->dev = dst->dev;
dev_hold(dst->dev); dev_hold(dst->dev);
......
...@@ -1190,7 +1190,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, ...@@ -1190,7 +1190,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
rcu_read_lock(); rcu_read_lock();
/* On shaper/eql skb->dst->neighbour != neigh :( */ /* On shaper/eql skb->dst->neighbour != neigh :( */
if (dst && (n2 = dst_get_neighbour(dst)) != NULL) if (dst && (n2 = dst_get_neighbour_noref(dst)) != NULL)
n1 = n2; n1 = n2;
n1->output(n1, skb); n1->output(n1, skb);
rcu_read_unlock(); rcu_read_unlock();
......
...@@ -202,7 +202,7 @@ static int dn_neigh_output_packet(struct sk_buff *skb) ...@@ -202,7 +202,7 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
{ {
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct dn_route *rt = (struct dn_route *)dst; struct dn_route *rt = (struct dn_route *)dst;
struct neighbour *neigh = dst_get_neighbour(dst); struct neighbour *neigh = dst_get_neighbour_noref(dst);
struct net_device *dev = neigh->dev; struct net_device *dev = neigh->dev;
char mac_addr[ETH_ALEN]; char mac_addr[ETH_ALEN];
......
...@@ -244,7 +244,7 @@ static int dn_dst_gc(struct dst_ops *ops) ...@@ -244,7 +244,7 @@ static int dn_dst_gc(struct dst_ops *ops)
*/ */
static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu) static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu)
{ {
struct neighbour *n = dst_get_neighbour(dst); struct neighbour *n = dst_get_neighbour_noref(dst);
u32 min_mtu = 230; u32 min_mtu = 230;
struct dn_dev *dn; struct dn_dev *dn;
...@@ -713,7 +713,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type ...@@ -713,7 +713,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
static int dn_to_neigh_output(struct sk_buff *skb) static int dn_to_neigh_output(struct sk_buff *skb)
{ {
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct neighbour *n = dst_get_neighbour(dst); struct neighbour *n = dst_get_neighbour_noref(dst);
return n->output(n, skb); return n->output(n, skb);
} }
...@@ -728,7 +728,7 @@ static int dn_output(struct sk_buff *skb) ...@@ -728,7 +728,7 @@ static int dn_output(struct sk_buff *skb)
int err = -EINVAL; int err = -EINVAL;
if ((neigh = dst_get_neighbour(dst)) == NULL) if ((neigh = dst_get_neighbour_noref(dst)) == NULL)
goto error; goto error;
skb->dev = dev; skb->dev = dev;
...@@ -852,7 +852,7 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res) ...@@ -852,7 +852,7 @@ static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
} }
rt->rt_type = res->type; rt->rt_type = res->type;
if (dev != NULL && dst_get_neighbour(&rt->dst) == NULL) { if (dev != NULL && dst_get_neighbour_noref(&rt->dst) == NULL) {
n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev); n = __neigh_lookup_errno(&dn_neigh_table, &rt->rt_gateway, dev);
if (IS_ERR(n)) if (IS_ERR(n))
return PTR_ERR(n); return PTR_ERR(n);
......
...@@ -731,7 +731,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev ...@@ -731,7 +731,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
} }
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
else if (skb->protocol == htons(ETH_P_IPV6)) { else if (skb->protocol == htons(ETH_P_IPV6)) {
struct neighbour *neigh = dst_get_neighbour(skb_dst(skb)); struct neighbour *neigh = dst_get_neighbour_noref(skb_dst(skb));
const struct in6_addr *addr6; const struct in6_addr *addr6;
int addr_type; int addr_type;
......
...@@ -206,7 +206,7 @@ static inline int ip_finish_output2(struct sk_buff *skb) ...@@ -206,7 +206,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
} }
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
if (neigh) { if (neigh) {
int res = neigh_output(neigh, skb); int res = neigh_output(neigh, skb);
......
...@@ -419,7 +419,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) ...@@ -419,7 +419,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
int len, HHUptod; int len, HHUptod;
rcu_read_lock(); rcu_read_lock();
n = dst_get_neighbour(&r->dst); n = dst_get_neighbour_noref(&r->dst);
HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0; HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0;
rcu_read_unlock(); rcu_read_unlock();
......
...@@ -657,7 +657,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, ...@@ -657,7 +657,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
* layer address of our nexhop router * layer address of our nexhop router
*/ */
if (dst_get_neighbour_raw(&rt->dst) == NULL) if (dst_get_neighbour_noref_raw(&rt->dst) == NULL)
ifa->flags &= ~IFA_F_OPTIMISTIC; ifa->flags &= ~IFA_F_OPTIMISTIC;
ifa->idev = idev; ifa->idev = idev;
......
...@@ -1533,7 +1533,7 @@ static int fib6_age(struct rt6_info *rt, void *arg) ...@@ -1533,7 +1533,7 @@ static int fib6_age(struct rt6_info *rt, void *arg)
RT6_TRACE("aging clone %p\n", rt); RT6_TRACE("aging clone %p\n", rt);
return -1; return -1;
} else if ((rt->rt6i_flags & RTF_GATEWAY) && } else if ((rt->rt6i_flags & RTF_GATEWAY) &&
(!(dst_get_neighbour_raw(&rt->dst)->flags & NTF_ROUTER))) { (!(dst_get_neighbour_noref_raw(&rt->dst)->flags & NTF_ROUTER))) {
RT6_TRACE("purging route %p via non-router but gateway\n", RT6_TRACE("purging route %p via non-router but gateway\n",
rt); rt);
return -1; return -1;
......
...@@ -136,7 +136,7 @@ static int ip6_finish_output2(struct sk_buff *skb) ...@@ -136,7 +136,7 @@ static int ip6_finish_output2(struct sk_buff *skb)
} }
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(dst); neigh = dst_get_neighbour_noref(dst);
if (neigh) { if (neigh) {
int res = neigh_output(neigh, skb); int res = neigh_output(neigh, skb);
...@@ -463,7 +463,7 @@ int ip6_forward(struct sk_buff *skb) ...@@ -463,7 +463,7 @@ int ip6_forward(struct sk_buff *skb)
send redirects to source routed frames. send redirects to source routed frames.
We don't send redirects to frames decapsulated from IPsec. We don't send redirects to frames decapsulated from IPsec.
*/ */
n = dst_get_neighbour(dst); n = dst_get_neighbour_noref(dst);
if (skb->dev == dst->dev && n && opt->srcrt == 0 && !skb_sec_path(skb)) { if (skb->dev == dst->dev && n && opt->srcrt == 0 && !skb_sec_path(skb)) {
struct in6_addr *target = NULL; struct in6_addr *target = NULL;
struct rt6_info *rt; struct rt6_info *rt;
...@@ -983,7 +983,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, ...@@ -983,7 +983,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
* dst entry of the nexthop router * dst entry of the nexthop router
*/ */
rcu_read_lock(); rcu_read_lock();
n = dst_get_neighbour(*dst); n = dst_get_neighbour_noref(*dst);
if (n && !(n->nud_state & NUD_VALID)) { if (n && !(n->nud_state & NUD_VALID)) {
struct inet6_ifaddr *ifp; struct inet6_ifaddr *ifp;
struct flowi6 fl_gw6; struct flowi6 fl_gw6;
......
...@@ -1238,7 +1238,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1238,7 +1238,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev); rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
if (rt) if (rt)
neigh = dst_get_neighbour(&rt->dst); neigh = dst_get_neighbour_noref(&rt->dst);
if (rt && lifetime == 0) { if (rt && lifetime == 0) {
neigh_clone(neigh); neigh_clone(neigh);
...@@ -1258,7 +1258,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1258,7 +1258,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
return; return;
} }
neigh = dst_get_neighbour(&rt->dst); neigh = dst_get_neighbour_noref(&rt->dst);
if (neigh == NULL) { if (neigh == NULL) {
ND_PRINTK0(KERN_ERR ND_PRINTK0(KERN_ERR
"ICMPv6 RA: %s() got default router without neighbour.\n", "ICMPv6 RA: %s() got default router without neighbour.\n",
......
...@@ -385,7 +385,7 @@ static void rt6_probe(struct rt6_info *rt) ...@@ -385,7 +385,7 @@ static void rt6_probe(struct rt6_info *rt)
* to no more than one per minute. * to no more than one per minute.
*/ */
rcu_read_lock(); rcu_read_lock();
neigh = rt ? dst_get_neighbour(&rt->dst) : NULL; neigh = rt ? dst_get_neighbour_noref(&rt->dst) : NULL;
if (!neigh || (neigh->nud_state & NUD_VALID)) if (!neigh || (neigh->nud_state & NUD_VALID))
goto out; goto out;
read_lock_bh(&neigh->lock); read_lock_bh(&neigh->lock);
...@@ -432,7 +432,7 @@ static inline int rt6_check_neigh(struct rt6_info *rt) ...@@ -432,7 +432,7 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
int m; int m;
rcu_read_lock(); rcu_read_lock();
neigh = dst_get_neighbour(&rt->dst); neigh = dst_get_neighbour_noref(&rt->dst);
if (rt->rt6i_flags & RTF_NONEXTHOP || if (rt->rt6i_flags & RTF_NONEXTHOP ||
!(rt->rt6i_flags & RTF_GATEWAY)) !(rt->rt6i_flags & RTF_GATEWAY))
m = 1; m = 1;
...@@ -786,7 +786,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort, ...@@ -786,7 +786,7 @@ static struct rt6_info *rt6_alloc_clone(struct rt6_info *ort,
if (rt) { if (rt) {
rt->rt6i_flags |= RTF_CACHE; rt->rt6i_flags |= RTF_CACHE;
dst_set_neighbour(&rt->dst, neigh_clone(dst_get_neighbour_raw(&ort->dst))); dst_set_neighbour(&rt->dst, neigh_clone(dst_get_neighbour_noref_raw(&ort->dst)));
} }
return rt; return rt;
} }
...@@ -820,7 +820,7 @@ static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table, ...@@ -820,7 +820,7 @@ static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
dst_hold(&rt->dst); dst_hold(&rt->dst);
read_unlock_bh(&table->tb6_lock); read_unlock_bh(&table->tb6_lock);
if (!dst_get_neighbour_raw(&rt->dst) && !(rt->rt6i_flags & RTF_NONEXTHOP)) if (!dst_get_neighbour_noref_raw(&rt->dst) && !(rt->rt6i_flags & RTF_NONEXTHOP))
nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr); nrt = rt6_alloc_cow(rt, &fl6->daddr, &fl6->saddr);
else if (!(rt->dst.flags & DST_HOST)) else if (!(rt->dst.flags & DST_HOST))
nrt = rt6_alloc_clone(rt, &fl6->daddr); nrt = rt6_alloc_clone(rt, &fl6->daddr);
...@@ -1629,7 +1629,7 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src, ...@@ -1629,7 +1629,7 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src,
dst_confirm(&rt->dst); dst_confirm(&rt->dst);
/* Duplicate redirect: silently ignore. */ /* Duplicate redirect: silently ignore. */
if (neigh == dst_get_neighbour_raw(&rt->dst)) if (neigh == dst_get_neighbour_noref_raw(&rt->dst))
goto out; goto out;
nrt = ip6_rt_copy(rt, dest); nrt = ip6_rt_copy(rt, dest);
...@@ -1721,7 +1721,7 @@ static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr ...@@ -1721,7 +1721,7 @@ static void rt6_do_pmtu_disc(const struct in6_addr *daddr, const struct in6_addr
1. It is connected route. Action: COW 1. It is connected route. Action: COW
2. It is gatewayed route or NONEXTHOP route. Action: clone it. 2. It is gatewayed route or NONEXTHOP route. Action: clone it.
*/ */
if (!dst_get_neighbour_raw(&rt->dst) && !(rt->rt6i_flags & RTF_NONEXTHOP)) if (!dst_get_neighbour_noref_raw(&rt->dst) && !(rt->rt6i_flags & RTF_NONEXTHOP))
nrt = rt6_alloc_cow(rt, daddr, saddr); nrt = rt6_alloc_cow(rt, daddr, saddr);
else else
nrt = rt6_alloc_clone(rt, daddr); nrt = rt6_alloc_clone(rt, daddr);
...@@ -2456,7 +2456,7 @@ static int rt6_fill_node(struct net *net, ...@@ -2456,7 +2456,7 @@ static int rt6_fill_node(struct net *net,
goto nla_put_failure; goto nla_put_failure;
rcu_read_lock(); rcu_read_lock();
n = dst_get_neighbour(&rt->dst); n = dst_get_neighbour_noref(&rt->dst);
if (n) if (n)
NLA_PUT(skb, RTA_GATEWAY, 16, &n->primary_key); NLA_PUT(skb, RTA_GATEWAY, 16, &n->primary_key);
rcu_read_unlock(); rcu_read_unlock();
...@@ -2653,7 +2653,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) ...@@ -2653,7 +2653,7 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
seq_puts(m, "00000000000000000000000000000000 00 "); seq_puts(m, "00000000000000000000000000000000 00 ");
#endif #endif
rcu_read_lock(); rcu_read_lock();
n = dst_get_neighbour(&rt->dst); n = dst_get_neighbour_noref(&rt->dst);
if (n) { if (n) {
seq_printf(m, "%pi6", n->primary_key); seq_printf(m, "%pi6", n->primary_key);
} else { } else {
......
...@@ -680,7 +680,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ...@@ -680,7 +680,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
struct neighbour *neigh = NULL; struct neighbour *neigh = NULL;
if (skb_dst(skb)) if (skb_dst(skb))
neigh = dst_get_neighbour(skb_dst(skb)); neigh = dst_get_neighbour_noref(skb_dst(skb));
if (neigh == NULL) { if (neigh == NULL) {
if (net_ratelimit()) if (net_ratelimit())
...@@ -705,7 +705,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, ...@@ -705,7 +705,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
struct neighbour *neigh = NULL; struct neighbour *neigh = NULL;
if (skb_dst(skb)) if (skb_dst(skb))
neigh = dst_get_neighbour(skb_dst(skb)); neigh = dst_get_neighbour_noref(skb_dst(skb));
if (neigh == NULL) { if (neigh == NULL) {
if (net_ratelimit()) if (net_ratelimit())
......
...@@ -277,7 +277,7 @@ static inline int teql_resolve(struct sk_buff *skb, ...@@ -277,7 +277,7 @@ static inline int teql_resolve(struct sk_buff *skb,
return 0; return 0;
rcu_read_lock(); rcu_read_lock();
mn = dst_get_neighbour(dst); mn = dst_get_neighbour_noref(dst);
res = mn ? __teql_resolve(skb, skb_res, dev, txq, mn) : 0; res = mn ? __teql_resolve(skb, skb_res, dev, txq, mn) : 0;
rcu_read_unlock(); rcu_read_unlock();
......
...@@ -1499,7 +1499,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, ...@@ -1499,7 +1499,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
goto free_dst; goto free_dst;
/* Copy neighbour for reachability confirmation */ /* Copy neighbour for reachability confirmation */
dst_set_neighbour(dst0, neigh_clone(dst_get_neighbour(dst))); dst_set_neighbour(dst0, neigh_clone(dst_get_neighbour_noref(dst)));
xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len); xfrm_init_path((struct xfrm_dst *)dst0, dst, nfheader_len);
xfrm_init_pmtu(dst_prev); xfrm_init_pmtu(dst_prev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册