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