Article 54S9T printk from iph->saddr stops my system

printk from iph->saddr stops my system

by
Traumatan
from LinuxQuestions.org on (#54S9T)
I am trying to print the IP address from the skb structure but I have no luck so far. After checking the documentation, I tried:

Code:printk(KERN_INFO "%pI4", iph->saddr);However, not only does it not work, it stops the system entirely.

First, how can this printk statement stop the whole system?

Second, what is the correct way to print the IP from the skb structure?

Edit: There were some notes when I compiled it, maybe they explain the problem?

Quote:
/include/linux/kern_levels.h:14:19: note: in expansion of macro KERN_SOH'
14 | #define KERN_INFO KERN_SOH "6" /* informational */
| ^~~~~~~~
/home/jens/bproram/test2.c:28:9: note: in expansion of macro KERN_INFO'
28 | printk(KERN_INFO "%pI4", iph->saddr);
| ^~~~~~~~~
/home/jens/bproram/test2.c:28:21: note: format string is defined here
28 | printk(KERN_INFO "%pI4", iph->saddr);
| ~^
latest?d=yIl2AUoC8zA latest?i=zkw8tIENBrA:ef8PHgPpQ5A:F7zBnMy latest?i=zkw8tIENBrA:ef8PHgPpQ5A:V_sGLiP latest?d=qj6IDK7rITs latest?i=zkw8tIENBrA:ef8PHgPpQ5A:gIN9vFwzkw8tIENBrA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments