From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Marek Lindner Date: Tue, 17 Apr 2012 12:33:31 +0200 References: <1334658294-2413-1-git-send-email-ordex@autistici.org> <1334658294-2413-2-git-send-email-ordex@autistici.org> In-Reply-To: <1334658294-2413-2-git-send-email-ordex@autistici.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201204171233.31979.lindner_marek@yahoo.de> Subject: Re: [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: introduce a boolean switch to enable/disable DAT Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: The list for a Better Approach To Mobile Ad-hoc Networking On Tuesday, April 17, 2012 12:24:53 Antonio Quartulli wrote: > +static void arp_change_timeout(struct net_device *soft_iface, bool > enable_dat) +{ > + struct in_device *in_dev = in_dev_get(soft_iface); > + if (!in_dev) { > + pr_err("Unable to set ARP parameters for the batman > interface '%s'\n", + soft_iface->name); > + return; > + } > + > + if (enable_dat) { > + /* Introduce a delay in the ARP state-machine transactions. > + * Entries will be kept in the ARP table for the default > time + * multiplied by 4 > + */ > + in_dev->arp_parms->base_reachable_time *= > ARP_TIMEOUT_FACTOR; + in_dev->arp_parms->gc_staletime *= > ARP_TIMEOUT_FACTOR; + in_dev->arp_parms->reachable_time *= > ARP_TIMEOUT_FACTOR; + } else { > + in_dev->arp_parms->base_reachable_time /= > ARP_TIMEOUT_FACTOR; + in_dev->arp_parms->gc_staletime /= > ARP_TIMEOUT_FACTOR; + in_dev->arp_parms->reachable_time /= > ARP_TIMEOUT_FACTOR; + } > + > + in_dev_put(in_dev); > +} > + > +void dat_sysfs_change(struct net_device *soft_iface) > +{ > + struct bat_priv *bat_priv = netdev_priv(soft_iface); > + > + if (!bat_priv) > + return; > + > + /* increase or decrease the ARP timeout */ > + arp_change_timeout(soft_iface, > + atomic_read(&bat_priv->distributed_arp_table)); > +} AFAIK there is no check whether the received value actually changes something but arp_change_timeout() implicitely assumes so. I guess the following will break the timeouts: echo 0 > /sys/class/net/bat0/mesh/distributed_arp_table echo 0 > /sys/class/net/bat0/mesh/distributed_arp_table Regards, Marek