* [ECOS] ECOS:Incorrect default gateway entry - Free BSD
@ 2007-07-23 22:20 Alok Singh
2007-07-24 6:39 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: Alok Singh @ 2007-07-23 22:20 UTC (permalink / raw)
To: ecos-discuss
Hi,
I'm trying to add the default gateway entry. I'm not able to
ping(access) the box from a different subnet. The dump of
"show_network_tables" is showing junk mask value. This may be the reason
why I'm not able to ping the
Box from a different subnet.
Interestingly, when I'm configuring the default gateway entry to
255.255.255.255, to enable DHCP client to send packets out, I'm not
getting any error. I'm able to get the address.
Dump when gateway is 255.255.255.255 -
***************
Destination Gateway Mask Flags Interface
0.0.0.0 0.0.0.0 -1.0.0.0 U eth0
0.0.0.0 255.255.255.255 0.0.0.0 UG eth0
Interface statistics
eth0 IP: 0.0.0.0, Broadcast: 255.255.255.255, Netmask: -1.0.0.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: -1.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
*************************************
After getting the DHCP address, I do a cyg_route_reinit(), and then
configure the stack again.
After route_reinit(), dump is -
***************
Destination Gateway Mask Flags Interface
Interface statistics
eth0 IP: 0.0.0.0, Broadcast: 255.255.255.255, Netmask: -1.0.0.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 6, Bytes: 1800, Tx - Packets: 4, Bytes: 1144
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: -1.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
*****************
After configuring the gateway,
*************************
Destination Gateway Mask Flags Interface
0.0.0.0 10.240.3.1 0.0.0.0.0.0.0.3.0.0.0.1 UG eth0
10.240.3.0 10.240.3.0 -1.-1.-1.0 U eth0
Interface statistics
Eth0 IP: 10.240.3.123, Broadcast: 10.240.3.255, Netmask: -1.-1.-1.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
lo0 IP: 127.0.0.1, Broadcast: 127
********************
Code is:
*************
struct ecos_rtentry route;
struct ifreq ifr;
struct sockaddr_in *addrp;
addrp = (struct sockaddr_in *) &ifr.ifr_addr;
if((sock = socket(AF_INET, SOCK_RAW, 0)) < 0) {
printf("Failed to Open Socket\n");
return L7_FAILURE;
}
memset(&route, 0x00, sizeof (route));
addrp->sin_family = AF_INET;
addrp->sin_port = 0;
addrp->sin_len = sizeof(*addrp);
addrp->sin_addr.s_addr = INADDR_ANY;
memcpy(&route.rt_dst, addrp, sizeof(*addrp));
addrp->sin_addr.s_addr = INADDR_ANY;
memcpy(&route.rt_genmask, addrp, sizeof(*addrp));
addrp->sin_addr.s_addr = osapiHtonl(gateway);
memcpy(&route.rt_gateway, addrp, sizeof(*addrp));
route.rt_dev = "eth0";
route.rt_flags = RTF_UP|RTF_GATEWAY;
route.rt_metric = 0;
if ((ioctl(sock, SIOCADDRT, &route) < 0) && (errno != EEXIST)) {
printf("l3intfAddRoute: Failed to Add Route\n");
close(sock);
********************************
regards,
Alok
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] ECOS:Incorrect default gateway entry - Free BSD
2007-07-23 22:20 [ECOS] ECOS:Incorrect default gateway entry - Free BSD Alok Singh
@ 2007-07-24 6:39 ` Andrew Lunn
2007-07-24 11:19 ` Alok Singh
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2007-07-24 6:39 UTC (permalink / raw)
To: Alok Singh; +Cc: ecos-discuss
On Tue, Jul 24, 2007 at 03:50:35AM +0530, Alok Singh wrote:
> Hi,
>
> I'm trying to add the default gateway entry. I'm not able to
> ping(access) the box from a different subnet. The dump of
> "show_network_tables" is showing junk mask value. This may be the reason
> why I'm not able to ping the
> Box from a different subnet.
>
> Interestingly, when I'm configuring the default gateway entry to
> 255.255.255.255, to enable DHCP client to send packets out, I'm not
> getting any error. I'm able to get the address.
>
> Dump when gateway is 255.255.255.255 -
This is not a valid host IP address. It is a broadcast address.
Try giving your gateway the IP address 192.168.0.1 and your target
192.168.0.2. Give both a netmask for 255.255.255.0.
Andrew
> ***************
> Destination Gateway Mask Flags Interface
>
> 0.0.0.0 0.0.0.0 -1.0.0.0 U eth0
^^
Im supprised you are getting -1 here. Obviously it should be
255. However, i would expect it to be printed correctly. What eCos
sources and gcc are you using?
> 0.0.0.0 255.255.255.255 0.0.0.0 UG eth0
>
> Interface statistics
>
> eth0 IP: 0.0.0.0, Broadcast: 255.255.255.255, Netmask: -1.0.0.0
>
> UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
>
> Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
>
> lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: -1.0.0.0
>
> UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
>
> Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
>
> *************************************
>
> After getting the DHCP address, I do a cyg_route_reinit(), and then
> configure the stack again.
>
> After route_reinit(), dump is -
> ***************
> Destination Gateway Mask Flags Interface
>
> Interface statistics
>
> eth0 IP: 0.0.0.0, Broadcast: 255.255.255.255, Netmask: -1.0.0.0
>
> UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
>
> Rx - Packets: 6, Bytes: 1800, Tx - Packets: 4, Bytes: 1144
>
> lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: -1.0.0.0
>
> UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
>
> Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
> *****************
>
> After configuring the gateway,
> *************************
> Destination Gateway Mask Flags Interface
>
> 0.0.0.0 10.240.3.1 0.0.0.0.0.0.0.3.0.0.0.1 UG eth0
^^^^^^^^^^^^^^^^^^^^^^^
This looks very strange. Why so many bytes?
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [ECOS] ECOS:Incorrect default gateway entry - Free BSD
2007-07-24 6:39 ` Andrew Lunn
@ 2007-07-24 11:19 ` Alok Singh
2007-07-24 11:26 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: Alok Singh @ 2007-07-24 11:19 UTC (permalink / raw)
To: Andrew Lunn; +Cc: ecos-discuss
Andrew,
The function do_bootp() in bootp_support.c file sets up routing with
gateway as "255.255.255.255". I'm using that piece of code only for my
DHCP client. Please have a look at the code below. I'm using ecos v2 and
the compiler is mipsisa32-elf-gcc.
**********************
// Set up routing
/* the broadcast address is 255.255.255.255 */
memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr));
memset(&route, 0, sizeof(route));
memcpy(&route.rt_gateway, addrp, sizeof(*addrp));
addrp->sin_family = AF_INET;
addrp->sin_port = 0;
addrp->sin_addr.s_addr = INADDR_ANY;
memcpy(&route.rt_dst, addrp, sizeof(*addrp));
memcpy(&route.rt_genmask, addrp, sizeof(*addrp));
route.rt_dev = ifr.ifr_name;
route.rt_flags = RTF_UP|RTF_GATEWAY;
route.rt_metric = 0;
if (ioctl(s, SIOCADDRT, &route)) {
if (errno != EEXIST) {
perror("SIOCADDRT 3");
goto out;
}
}
********************************
regards,
Alok
-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Tuesday, July 24, 2007 12:10 PM
To: Alok Singh
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] ECOS:Incorrect default gateway entry - Free BSD
On Tue, Jul 24, 2007 at 03:50:35AM +0530, Alok Singh wrote:
> Hi,
>
> I'm trying to add the default gateway entry. I'm not able to
> ping(access) the box from a different subnet. The dump of
> "show_network_tables" is showing junk mask value. This may be the
reason
> why I'm not able to ping the
> Box from a different subnet.
>
> Interestingly, when I'm configuring the default gateway entry to
> 255.255.255.255, to enable DHCP client to send packets out, I'm not
> getting any error. I'm able to get the address.
>
> Dump when gateway is 255.255.255.255 -
This is not a valid host IP address. It is a broadcast address.
Try giving your gateway the IP address 192.168.0.1 and your target
192.168.0.2. Give both a netmask for 255.255.255.0.
Andrew
> ***************
> Destination Gateway Mask Flags Interface
>
> 0.0.0.0 0.0.0.0 -1.0.0.0 U eth0
^^
Im supprised you are getting -1 here. Obviously it should be
255. However, i would expect it to be printed correctly. What eCos
sources and gcc are you using?
> 0.0.0.0 255.255.255.255 0.0.0.0 UG eth0
>
> Interface statistics
>
> eth0 IP: 0.0.0.0, Broadcast: 255.255.255.255, Netmask: -1.0.0.0
>
> UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
>
> Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
>
> lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: -1.0.0.0
>
> UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
>
> Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
>
> *************************************
>
> After getting the DHCP address, I do a cyg_route_reinit(), and then
> configure the stack again.
>
> After route_reinit(), dump is -
> ***************
> Destination Gateway Mask Flags Interface
>
> Interface statistics
>
> eth0 IP: 0.0.0.0, Broadcast: 255.255.255.255, Netmask: -1.0.0.0
>
> UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
>
> Rx - Packets: 6, Bytes: 1800, Tx - Packets: 4, Bytes: 1144
>
> lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: -1.0.0.0
>
> UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
>
> Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
> *****************
>
> After configuring the gateway,
> *************************
> Destination Gateway Mask Flags Interface
>
> 0.0.0.0 10.240.3.1 0.0.0.0.0.0.0.3.0.0.0.1 UG eth0
^^^^^^^^^^^^^^^^^^^^^^^
This looks very strange. Why so many bytes?
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
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [ECOS] ECOS:Incorrect default gateway entry - Free BSD
2007-07-24 11:19 ` Alok Singh
@ 2007-07-24 11:26 ` Andrew Lunn
2007-07-24 11:30 ` Alok Singh
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2007-07-24 11:26 UTC (permalink / raw)
To: Alok Singh; +Cc: ecos-discuss
On Tue, Jul 24, 2007 at 04:49:28PM +0530, Alok Singh wrote:
> Andrew,
> The function do_bootp() in bootp_support.c file sets up routing with
> gateway as "255.255.255.255". I'm using that piece of code only for my
> DHCP client. Please have a look at the code below. I'm using ecos v2 and
> the compiler is mipsisa32-elf-gcc.
eCos v2 is very, very old. I suggest you update to anoncvs, which has
a number of bug fixed in the network stack.
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [ECOS] ECOS:Incorrect default gateway entry - Free BSD
2007-07-24 11:26 ` Andrew Lunn
@ 2007-07-24 11:30 ` Alok Singh
0 siblings, 0 replies; 5+ messages in thread
From: Alok Singh @ 2007-07-24 11:30 UTC (permalink / raw)
To: Andrew Lunn; +Cc: ecos-discuss
Andrew,
I'll do that. But bootp_support.c file is same in current and ecos V2.
I've verified that.
regards,
Alok
-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Tuesday, July 24, 2007 4:56 PM
To: Alok Singh
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] ECOS:Incorrect default gateway entry - Free BSD
On Tue, Jul 24, 2007 at 04:49:28PM +0530, Alok Singh wrote:
> Andrew,
> The function do_bootp() in bootp_support.c file sets up routing with
> gateway as "255.255.255.255". I'm using that piece of code only for my
> DHCP client. Please have a look at the code below. I'm using ecos v2
and
> the compiler is mipsisa32-elf-gcc.
eCos v2 is very, very old. I suggest you update to anoncvs, which has
a number of bug fixed in the network stack.
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
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-24 11:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-23 22:20 [ECOS] ECOS:Incorrect default gateway entry - Free BSD Alok Singh
2007-07-24 6:39 ` Andrew Lunn
2007-07-24 11:19 ` Alok Singh
2007-07-24 11:26 ` Andrew Lunn
2007-07-24 11:30 ` Alok Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).