Duplicate routes (temp fix patch)

Richard B. Johnson (root@chaos.analogic.com)
Thu, 18 Feb 1999 15:20:51 -0500 (EST)


Until the kernel delete/add route code gets fixed so there are
not duplicate routes necessitating duplicate deletes until they
are finally gone, here is a patch to net-tools `route`. This will
help administrators who have large numbers of machines and don't
want to have to rewrite a lot of scripts.

This is against net-tools 1.47
Route 1.94

--- lib/inet_sr.c.orig Sat Jan 31 07:20:37 1998
+++ lib/inet_sr.c Thu Feb 18 15:08:28 1999
@@ -271,14 +271,21 @@
return(E_SOCK);
}

- /* Tell the kernel to accept this route. */
+ /* Tell the kernel to delete this route. */
if (action==RTACTION_DEL) {
if (ioctl(skfd, SIOCDELRT, &rt) < 0) {
perror("SIOCDELRT");
close(skfd);
return(E_SOCK);
}
+ else {
+ while(ioctl(skfd, SIOCDELRT, &rt) == 0) /* delete other entries */
+ ;
+ }
} else {
+ /* Tell the kernel to accept this route. */
+ while(ioctl(skfd, SIOCDELRT, &rt) == 0) /* delete any previous */
+ ;
if (ioctl(skfd, SIOCADDRT, &rt) < 0) {
perror("SIOCADDRT");
close(skfd);

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.1 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/