# Reading network data from an sk\_buffer

- From: \#PATHANGI JANARDHANAN JATINSHRAVAN\# \<hidden\>
- Date: 2017-02-14 15:36:10 
- List: netdev
- Page: https://ratatoskr.run/netdev/2017/02/11045032
- Thread: https://ratatoskr.run/netdev/2017/02/11045032/t.md

```text
Hi, 
      I have been trying to modify the xen-netback driver to print the data going into a VM from an external source, and have been trying with the example of a SSL Handshake. 

I would simply like to read the following message from the netback.c driver in xen-netback:


160302002f0100002b03026161616161616161616161616161616161616161616161616161616161616161000002000501000000


To accomplish this, I have been trying to get the sk_buff the xenvif_rx_action() function in xen-netback, which is called when the network rings are used in xen.

Now, for the relevant part, I've been trying to extract the TCP header from it using the tcp_hdr(skb) function, where skb is the sk_buffer and after that, extract the user_data with the following line of code:

user_data = (unsigned char *)((unsigned char *)tcph + (tcph->doff * 4)), where tcph is the tcp header from the tcp_hdr(skb) function.

I then get the tail of the sk_buffer from the skb_tail_pointer, and am trying to iterate from the user_data variable to the tail obtained. 

But I am not able to parse the hexadecimal string as shown above. Printing the userdata portion of the sk_buff using the printk, I notice that I get things like the below:

  \xffffffe9\xffffffe9

But never the actual hexadecimal string above that I wish to read.

Any help and guidance will be greatly appreciated. 

Thanks,
Jatin
```
