>     addrp = (struct sockaddr_in *) &ifr.ifr_addr;
>     memset(addrp, 0, sizeof(*addrp));
>     strcpy(ifr.ifr_name, eth1_name);
>     memset(&route, 0, sizeof(route));
>     addrp->sin_family = AF_INET;
>     addrp->sin_port = 0;
>     addrp->sin_len = sizeof(*addrp);
>     addrp->sin_addr.s_addr = inet_addr("192.165.4.0");
>     memset(&route, 0, sizeof(route));
>     memcpy(&route.rt_dst, addrp, sizeof(*addrp));
>     addrp->sin_addr.s_addr = inet_addr("255.255.255.0");
>     memcpy(&route.rt_genmask, addrp, sizeof(*addrp));
>     addrp->sin_addr.s_addr = 0;
>     memcpy(&route.rt_gateway, addrp, sizeof(*addrp));

[snip]
> Destination     Gateway         Mask            Flags    Interface
> 192.165.4.0     192.165.4.0     255.255.255.0   U        eth0    

I think the gateway is your problem. What you are saying is that to
reach 192.165.4.X go via 192.165.4.0. That makes no sense. What you
need to say is to reach 192.165.4.X go via 192.168.1.42. ie you need
to pass the IP address of the gateways local address, not its remove
address.
        
        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply via email to