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);
325 static int ndisc_constructor(struct neighbour *neigh) in ndisc_constructor() argument
327 struct in6_addr *addr = (struct in6_addr *)&neigh->primary_key; in ndisc_constructor()
328 struct net_device *dev = neigh->dev; in ndisc_constructor()
339 __neigh_parms_put(neigh->parms); in ndisc_constructor()
340 neigh->parms = neigh_parms_clone(parms); in ndisc_constructor()
342 neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST; in ndisc_constructor()
344 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
345 neigh->ops = &ndisc_direct_ops; in ndisc_constructor()
346 neigh->output = neigh_direct_output; in ndisc_constructor()
349 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
350 ndisc_mc_map(addr, neigh->ha, dev, 1); in ndisc_constructor()
352 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
353 memcpy(neigh->ha, dev->dev_addr, dev->addr_len); in ndisc_constructor()
355 neigh->type = RTN_LOCAL; in ndisc_constructor()
357 neigh->nud_state = NUD_NOARP; in ndisc_constructor()
358 memcpy(neigh->ha, dev->broadcast, dev->addr_len); in ndisc_constructor()
361 neigh->ops = &ndisc_hh_ops; in ndisc_constructor()
363 neigh->ops = &ndisc_generic_ops; in ndisc_constructor()
364 if (neigh->nud_state&NUD_VALID) in ndisc_constructor()
365 neigh->output = neigh->ops->connected_output; in ndisc_constructor()
367 neigh->output = neigh->ops->output; in ndisc_constructor()
706 static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb) in ndisc_error_report() argument
718 static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) in ndisc_solicit() argument
722 struct net_device *dev = neigh->dev; in ndisc_solicit()
723 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; in ndisc_solicit()
724 int probes = atomic_read(&neigh->probes); in ndisc_solicit()
730 probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); in ndisc_solicit()
732 if (!(neigh->nud_state & NUD_VALID)) { in ndisc_solicit()
738 } else if ((probes -= NEIGH_VAR(neigh->parms, APP_PROBES)) < 0) { in ndisc_solicit()
739 neigh_app_ns(neigh); in ndisc_solicit()
761 void ndisc_update(const struct net_device *dev, struct neighbour *neigh, in ndisc_update() argument
765 neigh_update(neigh, lladdr, new, flags, 0); in ndisc_update()
767 ndisc_ops_update(dev, neigh, flags, icmp6_type, ndopts); in ndisc_update()
782 struct neighbour *neigh; in ndisc_recv_ns() local
933 neigh = __neigh_lookup(&nd_tbl, saddr, dev, in ndisc_recv_ns()
935 if (neigh) in ndisc_recv_ns()
936 ndisc_update(dev, neigh, lladdr, NUD_STALE, in ndisc_recv_ns()
940 if (neigh || !dev->header_ops) { in ndisc_recv_ns()
943 if (neigh) in ndisc_recv_ns()
944 neigh_release(neigh); in ndisc_recv_ns()
966 struct neighbour *neigh; in ndisc_recv_na() local
1027 neigh = neigh_lookup(&nd_tbl, &msg->target, dev); in ndisc_recv_na()
1029 if (neigh) { in ndisc_recv_na()
1030 u8 old_flags = neigh->flags; in ndisc_recv_na()
1033 if (neigh->nud_state & NUD_FAILED) in ndisc_recv_na()
1048 ndisc_update(dev, neigh, lladdr, in ndisc_recv_na()
1056 if ((old_flags & ~neigh->flags) & NTF_ROUTER) { in ndisc_recv_na()
1064 neigh_release(neigh); in ndisc_recv_na()
1072 struct neighbour *neigh; in ndisc_recv_rs() local
1111 neigh = __neigh_lookup(&nd_tbl, saddr, skb->dev, 1); in ndisc_recv_rs()
1112 if (neigh) { in ndisc_recv_rs()
1113 ndisc_update(skb->dev, neigh, lladdr, NUD_STALE, in ndisc_recv_rs()
1118 neigh_release(neigh); in ndisc_recv_rs()
1173 struct neighbour *neigh = NULL; in ndisc_router_discovery() local
1296 neigh = ip6_neigh_lookup(&rt->fib6_nh->fib_nh_gw6, in ndisc_router_discovery()
1299 if (!neigh) { in ndisc_router_discovery()
1329 neigh = ip6_neigh_lookup(&rt->fib6_nh->fib_nh_gw6, in ndisc_router_discovery()
1332 if (!neigh) { in ndisc_router_discovery()
1339 neigh->flags |= NTF_ROUTER; in ndisc_router_discovery()
1400 if (!neigh) in ndisc_router_discovery()
1401 neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr, in ndisc_router_discovery()
1403 if (neigh) { in ndisc_router_discovery()
1414 ndisc_update(skb->dev, neigh, lladdr, NUD_STALE, in ndisc_router_discovery()
1528 if (neigh) in ndisc_router_discovery()
1529 neigh_release(neigh); in ndisc_router_discovery()
1652 struct neighbour *neigh = dst_neigh_lookup(skb_dst(skb), target); in ndisc_send_redirect() local
1653 if (!neigh) { in ndisc_send_redirect()
1659 read_lock_bh(&neigh->lock); in ndisc_send_redirect()
1660 if (neigh->nud_state & NUD_VALID) { in ndisc_send_redirect()
1661 memcpy(ha_buf, neigh->ha, dev->addr_len); in ndisc_send_redirect()
1662 read_unlock_bh(&neigh->lock); in ndisc_send_redirect()
1664 optlen += ndisc_redirect_opt_addr_space(dev, neigh, in ndisc_send_redirect()
1668 read_unlock_bh(&neigh->lock); in ndisc_send_redirect()
1670 neigh_release(neigh); in ndisc_send_redirect()