Lines Matching refs:neigh

124 static int arp_constructor(struct neighbour *neigh);
125 static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb);
126 static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb);
217 static bool arp_key_eq(const struct neighbour *neigh, const void *pkey) in arp_key_eq() argument
219 return neigh_key_eq32(neigh, pkey); in arp_key_eq()
222 static int arp_constructor(struct neighbour *neigh) in arp_constructor() argument
225 struct net_device *dev = neigh->dev; in arp_constructor()
231 memcpy(neigh->primary_key, &inaddr_any, arp_tbl.key_len); in arp_constructor()
233 addr = *(__be32 *)neigh->primary_key; in arp_constructor()
241 neigh->type = inet_addr_type_dev_table(dev_net(dev), dev, addr); in arp_constructor()
244 __neigh_parms_put(neigh->parms); in arp_constructor()
245 neigh->parms = neigh_parms_clone(parms); in arp_constructor()
249 neigh->nud_state = NUD_NOARP; in arp_constructor()
250 neigh->ops = &arp_direct_ops; in arp_constructor()
251 neigh->output = neigh_direct_output; in arp_constructor()
268 if (neigh->type == RTN_MULTICAST) { in arp_constructor()
269 neigh->nud_state = NUD_NOARP; in arp_constructor()
270 arp_mc_map(addr, neigh->ha, dev, 1); in arp_constructor()
272 neigh->nud_state = NUD_NOARP; in arp_constructor()
273 memcpy(neigh->ha, dev->dev_addr, dev->addr_len); in arp_constructor()
274 } else if (neigh->type == RTN_BROADCAST || in arp_constructor()
276 neigh->nud_state = NUD_NOARP; in arp_constructor()
277 memcpy(neigh->ha, dev->broadcast, dev->addr_len); in arp_constructor()
281 neigh->ops = &arp_hh_ops; in arp_constructor()
283 neigh->ops = &arp_generic_ops; in arp_constructor()
285 if (neigh->nud_state & NUD_VALID) in arp_constructor()
286 neigh->output = neigh->ops->connected_output; in arp_constructor()
288 neigh->output = neigh->ops->output; in arp_constructor()
293 static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb) in arp_error_report() argument
332 static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) in arp_solicit() argument
336 struct net_device *dev = neigh->dev; in arp_solicit()
337 __be32 target = *(__be32 *)neigh->primary_key; in arp_solicit()
338 int probes = atomic_read(&neigh->probes); in arp_solicit()
375 probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); in arp_solicit()
377 if (!(neigh->nud_state & NUD_VALID)) in arp_solicit()
379 neigh_ha_snapshot(dst_ha, neigh, dev); in arp_solicit()
382 probes -= NEIGH_VAR(neigh->parms, APP_PROBES); in arp_solicit()
384 neigh_app_ns(neigh); in arp_solicit()
1028 struct neighbour *neigh; in arp_req_set() local
1068 neigh = __neigh_lookup_errno(&arp_tbl, &ip, dev); in arp_req_set()
1069 err = PTR_ERR(neigh); in arp_req_set()
1070 if (!IS_ERR(neigh)) { in arp_req_set()
1074 err = neigh_update(neigh, (r->arp_flags & ATF_COM) ? in arp_req_set()
1078 neigh_release(neigh); in arp_req_set()
1083 static unsigned int arp_state_to_flags(struct neighbour *neigh) in arp_state_to_flags() argument
1085 if (neigh->nud_state&NUD_PERMANENT) in arp_state_to_flags()
1087 else if (neigh->nud_state&NUD_VALID) in arp_state_to_flags()
1100 struct neighbour *neigh; in arp_req_get() local
1103 neigh = neigh_lookup(&arp_tbl, &ip, dev); in arp_req_get()
1104 if (neigh) { in arp_req_get()
1105 if (!(neigh->nud_state & NUD_NOARP)) { in arp_req_get()
1106 read_lock_bh(&neigh->lock); in arp_req_get()
1107 memcpy(r->arp_ha.sa_data, neigh->ha, dev->addr_len); in arp_req_get()
1108 r->arp_flags = arp_state_to_flags(neigh); in arp_req_get()
1109 read_unlock_bh(&neigh->lock); in arp_req_get()
1114 neigh_release(neigh); in arp_req_get()
1121 struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); in arp_invalidate() local
1125 if (neigh) { in arp_invalidate()
1126 if (neigh->nud_state & ~NUD_NOARP) in arp_invalidate()
1127 err = neigh_update(neigh, NULL, NUD_FAILED, in arp_invalidate()
1131 neigh_release(neigh); in arp_invalidate()
1132 neigh_remove_one(neigh, tbl); in arp_invalidate()