This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Routing table


Hi,

thanks, that was it almost. I used as gateway the 192.168.1.1 and the
entry was added. It appears in the routing table with the wrong gateway,
but I hope it is not a problem. I'll have to do some testing.

Do you have any idea, how to add a host entry to the table? I used as
host the 192.165.4.2, gateway 192.168.1.1 and flags RTF_UP & RTF_HOST.
The call gets through but I don't see an entry in the routing table.
Like I wrote I can sent messages to the host (over a socket), but there
is nothing coming out of the ports.

C. Snider


Route - dst: 192.165.4.0, mask: 255.255.255.0, gateway: 192.168.1.1,
device: eth1
Routing tables
Destination     Gateway         Mask            Flags    Interface
0.0.0.0         192.168.0.1     0.0.0.0         UG       eth0
127.0.0.0       127.0.0.1       255.0.0.0       UG       lo0
192.165.4.0     192.165.4.0     255.255.255.0   U        eth1
192.168.0.0     192.168.0.0     255.255.255.0   U        eth0
192.168.1.0     192.168.1.0     255.255.255.0   U        eth1
Andrew Lunn schrieb:
>>     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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]