This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Re: connect() to machine outside local network


At 2000-07-14 12:19:33+0000, "Hugo 'NOx' Tyson" writes:
> 
> Nick Barnes <Nick.Barnes@pobox.com> writes:
> > It seems to me that build_bootp_record() in network_support.c should
> > 
> >         add_tag(vp, TAG_GATEWAY, ...)
> > 
> > and that its failure to do so could account for my problems here.
> > 
> > This from single stepping through most of init_all_network_interfaces().
> 
> This is if it's statically configured, right?  You're right, that makes
> perfect sense, I'll see to it.  BTW, full DHCP coming real soon...

I had to make two changes to get this to work.  first I did this 
in build_bootp_record:

#define DONT_FORGET_TO_ADD_GATEWAY 1
#if DONT_FORGET_TO_ADD_GATEWAY
    addr = inet_addr(addrs_gateway);
    vp = add_tag(vp, TAG_GATEWAY, &addr, sizeof(in_addr_t));
#endif

This still didn't work.  It told me (addressed redacted):

Route - dst: 192.168.0.0, mask: 255.255.255.0, gateway: 192.168.0.92

which is the wrong mask for a default gateway.  So I added this in the
obvious place in bootp_support.c:

#define SET_GATEWAY_ROUTE_MASK_TO_ZERO 1
#if SET_GATEWAY_ROUTE_MASK_TO_ZERO
        memset(&route.rt_genmask, 0, sizeof(route.rt_genmask));
#else
        addrp->sin_addr = netmask;
        memcpy(&route.rt_genmask, addrp, sizeof(*addrp));
#endif

And now I can establish connections with the rest of the world.
This may well not be the best way to do this.

Nick B

--
FreeBSD 2.2.8-RELEASE: up 12 days, 19:25
last reboot Sat Jul 1 19:26 (lightning strike)

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