Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

How to printk with IP address or MAC address in Linux Kernel Source Code

$
0
0

I have to change TCP Congestion Control algorithm a little bit by modifying Linux Kernel Source Code. But to check if the result is correct, I need to log info of MAC or IP address.

I used PRINTK function to print messages for kernel. But I feel hard to print out MAC/IP address of hosts.

printk("%pM \n", mac)

But what is mac refer to?In TCP source code, I often work with skbuff or sock struct.

Thank you.

UPDATE:

struct iphdr *iph = ip_hdr(skb);printk(KERN_DEBUG "%pI4", iph->saddr);

Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>