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);
218 static bool arp_key_eq(const struct neighbour *neigh, const void *pkey) in arp_key_eq() argument
220 return neigh_key_eq32(neigh, pkey); in arp_key_eq()
223 static int arp_constructor(struct neighbour *neigh) in arp_constructor() argument
226 struct net_device *dev = neigh->dev; in arp_constructor()
232 memcpy(neigh->primary_key, &inaddr_any, arp_tbl.key_len); in arp_constructor()
234 addr = *(__be32 *)neigh->primary_key; in arp_constructor()
242 neigh->type = inet_addr_type_dev_table(dev_net(dev), dev, addr); in arp_constructor()
245 __neigh_parms_put(neigh->parms); in arp_constructor()
246 neigh->parms = neigh_parms_clone(parms); in arp_constructor()
250 neigh->nud_state = NUD_NOARP; in arp_constructor()
251 neigh->ops = &arp_direct_ops; in arp_constructor()
252 neigh->output = neigh_direct_output; in arp_constructor()
269 if (neigh->type == RTN_MULTICAST) { in arp_constructor()
270 neigh->nud_state = NUD_NOARP; in arp_constructor()
271 arp_mc_map(addr, neigh->ha, dev, 1); in arp_constructor()
273 neigh->nud_state = NUD_NOARP; in arp_constructor()
274 memcpy(neigh->ha, dev->dev_addr, dev->addr_len); in arp_constructor()
275 } else if (neigh->type == RTN_BROADCAST || in arp_constructor()
277 neigh->nud_state = NUD_NOARP; in arp_constructor()
278 memcpy(neigh->ha, dev->broadcast, dev->addr_len); in arp_constructor()
282 neigh->ops = &arp_hh_ops; in arp_constructor()
284 neigh->ops = &arp_generic_ops; in arp_constructor()
286 if (neigh->nud_state & NUD_VALID) in arp_constructor()
287 neigh->output = neigh->ops->connected_output; in arp_constructor()
289 neigh->output = neigh->ops->output; in arp_constructor()
294 static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb) in arp_error_report() argument
333 static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) in arp_solicit() argument
337 struct net_device *dev = neigh->dev; in arp_solicit()
338 __be32 target = *(__be32 *)neigh->primary_key; in arp_solicit()
339 int probes = atomic_read(&neigh->probes); in arp_solicit()
376 probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES); in arp_solicit()
378 if (!(READ_ONCE(neigh->nud_state) & NUD_VALID)) in arp_solicit()
380 neigh_ha_snapshot(dst_ha, neigh, dev); in arp_solicit()
383 probes -= NEIGH_VAR(neigh->parms, APP_PROBES); in arp_solicit()
385 neigh_app_ns(neigh); in arp_solicit()
1049 struct neighbour *neigh; in arp_req_set() local
1089 neigh = __neigh_lookup_errno(&arp_tbl, &ip, dev); in arp_req_set()
1090 err = PTR_ERR(neigh); in arp_req_set()
1091 if (!IS_ERR(neigh)) { in arp_req_set()
1095 err = neigh_update(neigh, (r->arp_flags & ATF_COM) ? in arp_req_set()
1099 neigh_release(neigh); in arp_req_set()
1104 static unsigned int arp_state_to_flags(struct neighbour *neigh) in arp_state_to_flags() argument
1106 if (neigh->nud_state&NUD_PERMANENT) in arp_state_to_flags()
1108 else if (neigh->nud_state&NUD_VALID) in arp_state_to_flags()
1121 struct neighbour *neigh; in arp_req_get() local
1124 neigh = neigh_lookup(&arp_tbl, &ip, dev); in arp_req_get()
1125 if (neigh) { in arp_req_get()
1126 if (!(READ_ONCE(neigh->nud_state) & NUD_NOARP)) { in arp_req_get()
1127 read_lock_bh(&neigh->lock); in arp_req_get()
1128 memcpy(r->arp_ha.sa_data, neigh->ha, in arp_req_get()
1130 r->arp_flags = arp_state_to_flags(neigh); in arp_req_get()
1131 read_unlock_bh(&neigh->lock); in arp_req_get()
1136 neigh_release(neigh); in arp_req_get()
1143 struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); in arp_invalidate() local
1147 if (neigh) { in arp_invalidate()
1148 if ((READ_ONCE(neigh->nud_state) & NUD_VALID) && !force) { in arp_invalidate()
1149 neigh_release(neigh); in arp_invalidate()
1153 if (READ_ONCE(neigh->nud_state) & ~NUD_NOARP) in arp_invalidate()
1154 err = neigh_update(neigh, NULL, NUD_FAILED, in arp_invalidate()
1158 neigh_release(neigh); in arp_invalidate()
1159 neigh_remove_one(neigh, tbl); in arp_invalidate()