Re: bpf_trace_printk isn't working

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 30, 2017 at 5:18 PM, Brenden Blanco <bblanco@xxxxxxxxx> wrote:
> On Fri, Jun 30, 2017 at 2:16 PM, Y Song <ys114321@xxxxxxxxx> wrote:
>> Maybe *data is not a printable character?
>>
>> On Fri, Jun 30, 2017 at 12:54 PM, MD I. Islam <tamim@xxxxxxxxxxx> wrote:
>>> Hi
>>>
>>> I have following code attached to an interface:
>>>
>>> SEC("simple")
>>> int handle_ingress(struct __sk_buff *skb)
>>> {
>>>         unsigned char *data = (unsigned char *)(long)skb->data;
>
> Don't you need a data_end check first?

Yes, I will need those sanity check. I just posted the code snippet
that is causing the problem.
>
>>>         char fmt[] = "%u\n";
>>>         bpf_trace_printk(fmt, sizeof(fmt), *data);
>>>         return 0;
>>> }
>>>
>>> When packets pass through the interface, it does not print anything at
>>> /sys/kernel/debug/tracing/trace_pipe. However if I do
>>> bpf_trace_printk(fmt, sizeof(fmt), data), it prints the pointer. Could
>>> you please advise what is wrong here?
>>>
>>> Many thanks
>>> Tamim



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux