Please follow the format
[PATCH] Subject line
Patch description lines, specifically explaining the "why".
Signed-off
(see also
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/SubmittingPatches;h=689e2371095cc5dfea9927120009341f369159aa;hb=f6f94e2ab1b33f0082ac22d71f66385a60d8157f#l297)
The comments below apply if you can explain the use case to me. The
standard Linux networking stack seems to behave like current RTnet.
On 2011-12-13 17:22, Jesper Christensen wrote:
>
>
> diff --git a/stack/ipv4/af_inet.c b/stack/ipv4/af_inet.c
> index 8b394be..18754cf 100644
> --- a/stack/ipv4/af_inet.c
> +++ b/stack/ipv4/af_inet.c
> @@ -239,7 +239,16 @@ static void rt_ip_ifup(struct rtnet_device *rtdev,
> int i;
>
>
> - rt_ip_route_del_all(rtdev); /* cleanup routing table */
> + /* Only delete our own address if the new address is
> + on the same subnet */
> + if (rtdev->broadcast_ip == up_cmd->args.up.broadcast_ip)
> + rt_ip_route_del_host(rtdev->local_ip, rtdev);
> + else
> + rt_ip_route_del_all(rtdev); /* cleanup routing table */
> +
> + /* Delete our loopback route for the device */
The following block should be moved into the selective deletion path
above (as del_all already does it for us).
> + if ((tmp = rtdev_get_loopback()) != NULL)
Please split up assignment and comparison into two lines (yes, that used
to be done differently in past here as well).
> + rt_ip_route_del_host(rtdev->local_ip, tmp);
rtdev_dereference(tmp) is missing.
>
> if (up_cmd->args.up.ip_addr != 0xFFFFFFFF) {
> rtdev->local_ip = up_cmd->args.up.ip_addr;
Thanks,
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
|