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: issue with raw bsd sockets


On Fri, Aug 7, 2009 at 6:21 PM, Sergei
Gavrikov<sergei.gavrikov@gmail.com> wrote:
> Mandeep Sandhu wrote:
>> I'm using the FreeBSD stack on my Linux Synthetic target to implement
>> a tiny DHCP server. I can receive DHCP REQUEST packets coming over the
>> tap interface, but am unable to send back the broadcast resp packet
>> (DHCP Offer).
>
> [snip]
>
>> Any hint's appreciated.
>
> Hi Mandeep,
>
> I call that recently Jay Foster share on the list a solution
> http://sourceware.org/ml/ecos-discuss/2009-06/msg00075.html
> Follow this thread. HIH.

Thanks Sergei. This is _exactly_ my problem too.

Though this patch didn't help much. Now my IP broadcast addr is not
converted to the subnet bcast addr of the interface...but my ip_output
function fails when trying to get an interface for 255.255.255.255

Here's where it fails:

packages/net/bsd_tcpip/v3_0/src/sys/netinet/ip_output.c

<snip>
...
    if (flags & IP_ROUTETOIF) {
        if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 &&
            (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { <<---- PROBLEM!
            ipstat.ips_noroute++;
            error = ENETUNREACH; <<-- shows up as 'Network is unreachable'
            goto bad;
        }
        ifp = ia->ia_ifp;
        ip->ip_ttl = 1;
        isbroadcast = in_broadcast(dst->sin_addr, ifp);
    }
...
</snip>

Any other clue? Or should I switch stack to LWIP? Any idea if this works in
LWIP?

Looking at the same function in lwip stack...I see it picks up the
default interface
if the route lookup does not find a suitable match.

Thanks,
-mandeep

>
> Sergei
>

-- 
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]