ILD

strace show all arguments & payload data
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2023-6-14 站点:Inside Linux Development

在使用strace分析netlink协议时,发现netlink消息的数据显示不全。


# strace -e sendmsg tc filter add dev veth1 parent 1:0 handle 3 protocol ip prio 1 flow map key dst and 0xff addend 2 baseclass 1:1

sendmsg(4, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[{iov_base={{len=100, type=RTM_NEWTFILTER, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL|NLM_F_CREATE, seq=1686740798, pid=0}, {tcm_family=AF_UNSPEC, tcm_ifindex=if_nametoindex("veth1"), tcm_handle=3, tcm_parent=65536, tcm_info=65544}, [{{nla_len=9, nla_type=TCA_KIND}, "flow"}, {{nla_len=52, nla_type=TCA_OPTIONS}, "\x08\x00\x01\x00\x02\x00\x00\x00\x08\x00\x05\x00\x02\x00\x00\x00\x08\x00\x03\x00\x01\x00\x01\x00\x08\x00\x02\x00\x00\x00\x00\x00"...}]}, iov_len=100}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 100


可以看到TCA_OPTIONS的数据,没打印全,有个。。。


加上-s选项,就可以了

# strace -s 1000 -e sendmsg tc filter add dev veth1 parent 1:0 handle 3 protocol ip prio 1 flow map key dst and 0xff addend 2 baseclass 1:1

sendmsg(4, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[{iov_base={{len=100, type=RTM_NEWTFILTER, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_EXCL|NLM_F_CREATE, seq=1686740849, pid=0}, {tcm_family=AF_UNSPEC, tcm_ifindex=if_nametoindex("veth1"), tcm_handle=3, tcm_parent=65536, tcm_info=65544}, [{{nla_len=9, nla_type=TCA_KIND}, "flow"}, {{nla_len=52, nla_type=TCA_OPTIONS}, "\x08\x00\x01\x00\x02\x00\x00\x00\x08\x00\x05\x00\x02\x00\x00\x00\x08\x00\x03\x00\x01\x00\x01\x00\x08\x00\x02\x00\x00\x00\x00\x00\x08\x00\x06\x00\xff\x00\x00\x00\x08\x00\x07\x00\x00\x00\x00\x00"}]}, iov_len=100}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 100

https://stackoverflow.com/questions/34365928/show-complete-arguments-in-strace-even-in-curly-brackets/34373478



Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.