Hi Rob,

On Mon, 2008-05-26 at 03:36 -0700, Rob Loefman wrote:
> Hi,
> the code in the attachment freezes up my Sparc T5120 with 
> OpenSolaris/Clearview.
> I get no errors while compiling nor when running the program, only freeze-up 
> so
> that HW restart is needed.

The bad news is that I cannot reproduce the hang, and that I found a
number of problems in your program.  The good news is that I modified
your code such that it works.  I've attached a version of the code with
my modifications.  The changes I made were:

* Split up various code blocks into individual lines so that I could
read the code.

* Removed the DLPI_RAW flag from dlpi_open(), as you're not sending a
raw outer IP header with the data.

* changed "dst" to a 4 byte character array with four 0 bytes.  The
value doesn't matter here since the tunnel will always use the
pre-configured tunnel destination.

* Created a dlpi_sendinfo_t variable sendinfo, and set sdi_sap to
IPPROTO_ENCAP.  This is crucial since the kernel needs to know what
protocol to set in the outer IP header.

* changed the dlpi_send() call to take the above into account, so it now
looks like:

        err = dlpi_send(dh, dst, sizeof (dst), ipPacket, sizeof (ipPacket),
            &sendinfo);

> 
> It is probably interesting to know even though I might have some trivial error
> in the code. BTW if someone finds it, please let me know. It is the first time
> I've used dlpi_open and I'm unsure about the destination MAC address (should 
> the
> sap be included , 0x0800?)

See above.  Let me know if you have questions on what I did.

-Seb

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iptun-test.c
Type: text/x-csrc
Size: 1957 bytes
Desc: not available
URL: 
<http://mail.opensolaris.org/pipermail/clearview-discuss/attachments/20080527/dc506d32/attachment.bin>

Reply via email to