net: core: Send ARP probe and trigger RTM_NEWNEIGH

Send ARP probe and generate RTM_NEWNEIGH if the neighbor
state is not NUD_REACHABLE. Also featurize changes for
sending neighbor probe.

Change-Id: I633285b8e0cbcd49291d5e52136f11e20f2388bc
Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
This commit is contained in:
Ravinder Konka 2015-04-09 11:42:00 +05:30
parent 8579cbb786
commit c5b6f10e5d
1 changed files with 23 additions and 3 deletions

View File

@ -55,6 +55,7 @@ static void neigh_update_notify(struct neighbour *neigh);
static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
static struct neigh_table *neigh_tables;
static unsigned neigh_probe_enable;
#ifdef CONFIG_PROC_FS
static const struct file_operations neigh_stat_seq_fops;
#endif
@ -1236,9 +1237,20 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl,
{
struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev,
lladdr || !dev->addr_len);
if (neigh)
neigh_update(neigh, lladdr, NUD_STALE,
NEIGH_UPDATE_F_OVERRIDE);
if (neigh) {
if (neigh_probe_enable) {
if (!(neigh->nud_state == NUD_REACHABLE)) {
neigh_update(neigh, lladdr, NUD_STALE,
NEIGH_UPDATE_F_OVERRIDE);
write_lock(&neigh->lock);
neigh_probe(neigh);
neigh_update_notify(neigh);
}
} else {
neigh_update(neigh, lladdr, NUD_STALE,
NEIGH_UPDATE_F_OVERRIDE);
}
}
return neigh;
}
EXPORT_SYMBOL(neigh_event_ns);
@ -2807,6 +2819,7 @@ enum {
NEIGH_VAR_GC_THRESH1,
NEIGH_VAR_GC_THRESH2,
NEIGH_VAR_GC_THRESH3,
NEIGH_VAR_PROBE,
NEIGH_VAR_MAX
};
@ -2930,6 +2943,12 @@ static struct neigh_sysctl_table {
.mode = 0644,
.proc_handler = proc_dointvec,
},
[NEIGH_VAR_PROBE] = {
.procname = "neigh_probe",
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{},
},
};
@ -2960,6 +2979,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
t->neigh_vars[NEIGH_VAR_LOCKTIME].data = &p->locktime;
t->neigh_vars[NEIGH_VAR_RETRANS_TIME_MS].data = &p->retrans_time;
t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].data = &p->base_reachable_time;
t->neigh_vars[NEIGH_VAR_PROBE].data = &neigh_probe_enable;
if (dev) {
dev_name_source = dev->name;