I just tried to activate ax25rtd (from ax25-utils-2.0.12c), but can't
use it in the present state.
I have two radio interfaces which should belong to the same subnet.
Users should be able to connect their stations to either interface.
Proxy-ARP already works quite nicely with help of the kernel, but I also
need a daemon that sets the IP host routes with the correct interface.
ax25rtd should handle this. But unfortunately, if a user switches from
one interface to the other, the old route is NOT deleted, resulting in
two host routes with the same IP address, but different interfaces. If I
have bad luck, the route with the wrong interface comes first.
The following patch should fix this, but I assume similar problems are
also present in the ARP table maintenance and in the AX25 routing table
maintenance.
--- listener.c.ORIG Sun Jan 5 19:21:29 1997
+++ listener.c Sun Jan 5 20:52:04 1997
@@ -23,6 +23,7 @@
*/
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ioctl.h>
@@ -165,9 +166,6 @@
int fds;
FILE *fp;
- if (!config->ip_add_route)
- return 0;
-
fp = fopen(PROC_IP_ROUTE_FILE, "r");
if (fp == NULL)
{
@@ -179,21 +177,32 @@
while (fgets(buf, sizeof(buf)-1, fp) != NULL)
{
sscanf(buf, "%s %lx", origdev, &ipr);
- if (ipr == ip && dev_get_config(origdev) == NULL)
+ if (ipr == ip)
{
- invalidate_ip_route(ip);
- fclose(fp);
- return 1;
- }
+ if (dev_get_config(origdev) == NULL)
+ {
+ invalidate_ip_route(ip);
+ fclose(fp);
+ return 1;
+ }
+ else
+ {
+ del_kernel_ip_route(origdev, ip);
+ }
+ }
}
fclose(fp);
+ if (!config->ip_add_route)
+ return 0;
+
fds = socket(AF_INET, SOCK_DGRAM, 0);
+ memset((char *) &rt, 0, sizeof(struct rtentry));
+
isa = (struct sockaddr_in *) &rt.rt_dst;
isa->sin_family = AF_INET;
- isa->sin_port = 0;
isa->sin_addr.s_addr = ip;
rt.rt_flags = RTF_UP | RTF_HOST;
@@ -226,13 +235,14 @@
fds = socket(AF_INET, SOCK_DGRAM, 0);
+ memset((char *) &rt, 0, sizeof(struct rtentry));
+
isa = (struct sockaddr_in *) &rt.rt_dst;
isa->sin_family = AF_INET;
- isa->sin_port = 0;
isa->sin_addr.s_addr = ip;
- rt.rt_flags = RTF_HOST;
+ rt.rt_flags = RTF_UP | RTF_HOST;
rt.rt_dev = dev;
if (ioctl(fds, SIOCDELRT, &rt) < 0)
-- Klaus Kudielka OE1KIB Peter Jordanstr. 165, A-1180 Wien, AUSTRIA kmn@gdansk.sprint.pl http://oe1xtu.ampr.org/~oe1kib/ qeqfuy@bof.fi http://asterix.nt.tuwien.ac.at/~oe1kib/