Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SKB #16

Open
GoogleCodeExporter opened this issue Mar 15, 2015 · 6 comments
Open

How to use SKB #16

GoogleCodeExporter opened this issue Mar 15, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 25 Apr 2012 at 7:36

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 25 Apr 2012 at 8:48

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 26 Apr 2012 at 1:06

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 26 Apr 2012 at 1:48

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 26 Apr 2012 at 3:57

@GoogleCodeExporter
Copy link
Author

Please disregard. My capturing device was truncating packets.

Original comment by [email protected] on 26 Apr 2012 at 5:55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant