Lines Matching refs:neigh
75 static bool ndisc_key_eq(const struct neighbour *neigh, const void *pkey);
78 static int ndisc_constructor(struct neighbour *neigh);
79 static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb);
80 static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb);
326 static int ndisc_constructor(struct neighbour *neigh) in ndisc_constructor() argument
328 struct in6_addr *addr = (struct in6_addr *)&neigh->primary_key; in ndisc_constructor()
329 struct net_device *dev = neigh->dev; in ndisc_constructor()
340 __neigh_parms_put(neigh->parms); in ndisc_constructor()
341 neigh->parms = neigh_parms_clone(parms); in ndisc_constructor()
343 neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST; in ndisc_constructor()
345 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
346 neigh->ops = &ndisc_direct_ops; in ndisc_constructor()
347 neigh->output = neigh_direct_output; in ndisc_constructor()
350 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
351 ndisc_mc_map(addr, neigh->ha, dev, 1); in ndisc_constructor()
353 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
354 memcpy(neigh->ha, dev->dev_addr, dev->addr_len); in ndisc_constructor()
356 neigh->type = RTN_LOCAL; in ndisc_constructor()
358 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
359 memcpy(neigh->ha, dev->broadcast, dev->addr_len); in ndisc_constructor()
362 neigh->ops = &ndisc_hh_ops; in ndisc_constructor()
364 neigh->ops = &ndisc_generic_ops; in ndisc_constructor()
365 if (neigh->nud_state&NUD_VALID) in ndisc_constructor()
366 neigh->output = neigh->ops->connected_output; in ndisc_constructor()
368 neigh->output = neigh->ops->output; in ndisc_constructor()
722 static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) in ndisc_error_report() argument
734 static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) in ndisc_solicit() argument
738 struct net_device *dev = neigh->dev; in ndisc_solicit()
739 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; in ndisc_solicit()
740 int probes = atomic_read(&neigh->probes); in ndisc_solicit()
746 probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); in ndisc_solicit()
748 if (!(neigh->nud_state & NUD_VALID)) { in ndisc_solicit()
754 } else if ((probes -= NEIGH_VAR(neigh->parms, APP_PROBES)) < 0) { in ndisc_solicit()
755 neigh_app_ns(neigh); in ndisc_solicit()
777 void ndisc_update(const struct net_device *dev, struct neighbour *neigh, in ndisc_update() argument
781 neigh_update(neigh, lladdr, new, flags, 0); in ndisc_update()
783 ndisc_ops_update(dev, neigh, flags, icmp6_type, ndopts); in ndisc_update()
798 struct neighbour *neigh; in ndisc_recv_ns() local
949 neigh = __neigh_lookup(&nd_tbl, saddr, dev, in ndisc_recv_ns()
951 if (neigh) in ndisc_recv_ns()
952 ndisc_update(dev, neigh, lladdr, NUD_STALE, in ndisc_recv_ns()
956 if (neigh || !dev->header_ops) { in ndisc_recv_ns()
959 if (neigh) in ndisc_recv_ns()
960 neigh_release(neigh); in ndisc_recv_ns()
1001 struct neighbour *neigh; in ndisc_recv_na() local
1065 neigh = neigh_lookup(&nd_tbl, &msg->target, dev); in ndisc_recv_na()
1083 if (!neigh && lladdr && idev && idev->cnf.forwarding) { in ndisc_recv_na()
1085 neigh = neigh_create(&nd_tbl, &msg->target, dev); in ndisc_recv_na()
1090 if (neigh && !IS_ERR(neigh)) { in ndisc_recv_na()
1091 u8 old_flags = neigh->flags; in ndisc_recv_na()
1094 if (neigh->nud_state & NUD_FAILED) in ndisc_recv_na()
1109 ndisc_update(dev, neigh, lladdr, in ndisc_recv_na()
1117 if ((old_flags & ~neigh->flags) & NTF_ROUTER) { in ndisc_recv_na()
1125 neigh_release(neigh); in ndisc_recv_na()
1133 struct neighbour *neigh; in ndisc_recv_rs() local
1172 neigh = __neigh_lookup(&nd_tbl, saddr, skb->dev, 1); in ndisc_recv_rs()
1173 if (neigh) { in ndisc_recv_rs()
1174 ndisc_update(skb->dev, neigh, lladdr, NUD_STALE, in ndisc_recv_rs()
1179 neigh_release(neigh); in ndisc_recv_rs()
1234 struct neighbour *neigh = NULL; in ndisc_router_discovery() local
1357 neigh = ip6_neigh_lookup(&rt->fib6_nh->fib_nh_gw6, in ndisc_router_discovery()
1360 if (!neigh) { in ndisc_router_discovery()
1381 if (neigh) in ndisc_router_discovery()
1382 neigh_release(neigh); in ndisc_router_discovery()
1393 neigh = ip6_neigh_lookup(&rt->fib6_nh->fib_nh_gw6, in ndisc_router_discovery()
1396 if (!neigh) { in ndisc_router_discovery()
1403 neigh->flags |= NTF_ROUTER; in ndisc_router_discovery()
1468 if (!neigh) in ndisc_router_discovery()
1469 neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr, in ndisc_router_discovery()
1471 if (neigh) { in ndisc_router_discovery()
1482 ndisc_update(skb->dev, neigh, lladdr, NUD_STALE, in ndisc_router_discovery()
1596 if (neigh) in ndisc_router_discovery()
1597 neigh_release(neigh); in ndisc_router_discovery()
1720 struct neighbour *neigh = dst_neigh_lookup(skb_dst(skb), target); in ndisc_send_redirect() local
1721 if (!neigh) { in ndisc_send_redirect()
1727 read_lock_bh(&neigh->lock); in ndisc_send_redirect()
1728 if (neigh->nud_state & NUD_VALID) { in ndisc_send_redirect()
1729 memcpy(ha_buf, neigh->ha, dev->addr_len); in ndisc_send_redirect()
1730 read_unlock_bh(&neigh->lock); in ndisc_send_redirect()
1732 optlen += ndisc_redirect_opt_addr_space(dev, neigh, in ndisc_send_redirect()
1736 read_unlock_bh(&neigh->lock); in ndisc_send_redirect()
1738 neigh_release(neigh); in ndisc_send_redirect()