AMP-VTV / openpgm

Automatically exported from code.google.com/p/openpgm
0 stars 0 forks source link

How to use SKB #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I use PGM over UDP (no rate control). I have the following lines in my program:

//---------------------------------
m_pgmPktOffset = pgm_pkt_offset(false, 0);
m_skb = pgm_alloc_skb(1400);
pgm_skb_reserve(m_skb, m_pgmPktOffset);

pgm_skb_put(m_skb, sizeof(SeqPacketHeader));
memcpy(m_skb.tail, packet, sizeof(SeqPacketHeader));

size_t bytesWritten;
int status = pgm_send_skbv(m_sock, &m_skb, 1, true, &bytesWritten);
//---------------------------------

All UDP datagrams transmitted by this process are empty. Anything that I miss 
here?
Btw, pgm_pkt_offset() is not exposed in public header files.

What version of the product are you using? On what operating system?

openpgm-5.1.118
Linux 2.6.18-238.12.1.el5

Original issue reported on code.google.com by astov...@gmail.com on 25 Apr 2012 at 7:36

GoogleCodeExporter commented 8 years ago
The pgmping utility gives an example usage, you want the skb::data field not 
the skb::tail as that points to the end of the reserved area after a skb_put() 
call.  Updating your example:

m_pgmPktOffset = pgm_pkt_offset(false, 0);
m_skb = pgm_alloc_skb(1400);
pgm_skb_reserve(m_skb, m_pgmPktOffset);

pgm_skb_put(m_skb, sizeof(SeqPacketHeader));
memcpy(m_skb->data, packet, sizeof(SeqPacketHeader));

size_t bytesWritten;
int status = pgm_send_skbv(m_sock, &m_skb, 1, true, &bytesWritten);

http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/examples/pgmpin
g.cc

-- 
Steve-o

Original comment by fnjo...@gmail.com on 25 Apr 2012 at 8:48

GoogleCodeExporter commented 8 years ago
Actually, I made this mistake when posting the code. My real code is fine:

void* ptr = pgm_skb_put(m_skb, sizeof(SeqPacketHeader));
memcpy(ptr, ...);

I still cannot find an explanation for empty UDP packets. They don't even have 
PGM headers in them (The length in UDP header is 8). pgm_send() works fine, 
though.

Also, why is declaration for pgm_pkt_offset() not publicly available? Is it not 
supposed to be used or is it a bug?

--alex

Original comment by astov...@gmail.com on 26 Apr 2012 at 1:06

GoogleCodeExporter commented 8 years ago
Can you insert a breakpoint in GDB and inspect the SKB contents?

The lack of the prototype pgm_pkt_offset() is my mistake, I think it has been 
mentioned before and as I added the prototype to pgmping I forgot about it.  
Consider it tracked with this issue.

-- 
Steve-o

Original comment by fnjo...@gmail.com on 26 Apr 2012 at 1:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This is SKB just before teh call to pgm_send_skbv:

$1 = {link_ = {data = 0x0, next = 0x0, prev = 0x0}, sock = 0x0, tstamp = 0, tsi 
= {gsi = {identifier = "\000\000\000\000\000"}, sport = 0}, sequence = 0,
  __padding = 0, cb = '\000' <repeats 47 times>, len = 57, zero_padded = 0, __padding2 = 0, pgm_header = 0x0, pgm_opt_fragment = 0x0, pgm_opt_pgmcc_data = 0x0,
  pgm_data = 0x0, head = 0x6968d8, data = 0x6968f0, tail = 0x696929, end = 0x696e50, truesize = 1584, users = 1}

All pointers look correct to me.

Original comment by astov...@gmail.com on 26 Apr 2012 at 3:57

GoogleCodeExporter commented 8 years ago
Please disregard. My capturing device was truncating packets.

Original comment by astov...@gmail.com on 26 Apr 2012 at 5:55