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 */
+    if ((tmp = rtdev_get_loopback()) != NULL)
+        rt_ip_route_del_host(rtdev->local_ip, tmp);
 
     if (up_cmd->args.up.ip_addr != 0xFFFFFFFF) {
         rtdev->local_ip     = up_cmd->args.up.ip_addr;
-- 
1.7.5.4

-- 
/Jesper



------------------------------------------------------------------------------
Systems Optimization Self Assessment
Improve efficiency and utilization of IT resources. Drive out cost and 
improve service delivery. Take 5 minutes to use this Systems Optimization 
Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/
_______________________________________________
RTnet-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-developers

Reply via email to