> Yes I have found that section of code.... There's even a big FIXME sign
> in the comments above it. I am now writing a simple fix.. :-)
Ok, I've written a fix to my problem. With this patch diald checks what
kernel version it is being run on, and if it finds a kernel version
equal to or greater then 2.2.x it won't add a second route to the remote
end of the SLIP/PPP link.
I will put the patch on a web page as well, probably here:
http://www.casema.net/~silicon/diald
Kick Glorie
--- ./diald/route.c Wed Jun 2 00:49:55 1999
+++ ./diald-new/route.c Tue Oct 26 18:01:33 1999
@@ -8,6 +8,51 @@
*/
#include "diald.h"
+/************************************/
+/* Modified by Kick Glorie 26/10/99 */
+/* [EMAIL PROTECTED] */
+/* added for kernel version check: */
+/************************************/
+#include <sys/utsname.h>
+
+int linuxver;
+/************************************************************/
+/* this function added to check for 2.2.x kernels or higher */
+/* returns 0 if kernelver > 2.2.x */
+/* returns 1 if kernelver < 2.2.x */
+/************************************************************/
+
+void checkkernel(void)
+{
+ char kernelver[10]; /* I guess this should be sufficient */
+ int mainver; /* int for main kernel version number */
+ int minorver; /* int for minor kernel version number */
+ struct utsname name;
+
+ linuxver = 1;
+ mainver = 0;
+ minorver = 0;
+ uname(&name); /* get current kernel version */
+ strcpy(kernelver,name.release);
+ mainver = kernelver[0]; /* this construction probably needs */
+ minorver = kernelver[2]; /* fixing once we get to linux kernel */
+ /* version 10.0.x :-) */
+ if (mainver>=50)
+ {
+ if (minorver>=50)
+ {
+ linuxver = 0; /* kernel version 2.2.x or higher */
+ }
+ else
+ {
+ linuxver = 1; /* kernel version between 2.0.x and 2.2.0 */
+ }
+ }
+ else
+ {
+ linuxver = 1; /* kernel version below 2.0.x */
+ }
+}
static void
add_routes(char *desc, char *iface, char *lip, char *rip)
@@ -27,14 +72,19 @@
win[0] = 0;
else
sprintf(win,"window %d",window);
-
-#if 1
+
+ checkkernel(); /* Call checkkernel() so we know what */
+ /* kernel we are running */
+ if (linuxver==1) {
/* FIXME: this is only needed for 2.0 kernels. 2.2 and beyond
* create routes automatically when the interface is configured.
* On 2.2 and later kernels this just creates some annoying
* duplicate routes. But if the metric is non-zero we can,
* and should, get rid of the original zero metric route.
*/
+ /**********************************************/
+ /* above FIXME obsoleted bij checkkernel code */
+ /**********************************************/
if (rip) {
if (path_ip && *path_ip) {
sprintf(buf,"%s route add %s dev %s scope link%s%s metric %d %s",
@@ -61,9 +111,9 @@
}
run_shell(SHELL_WAIT, desc, buf, -1);
}
-#endif
}
-
+ }
+
/* Add in a default route for the link if required. */
if (default_route) {
if (path_ip && *path_ip) {