FreeBSD Bugzilla – Attachment 148695 Details for
Bug 194577
mbuf packet header leakage when closing TUN devices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
kernel function for printing mbuf info
main.c (text/plain), 1.00 KB, created by
Andrey V. Elsukov
on 2014-10-27 09:06:01 UTC
(
hide
)
Description:
kernel function for printing mbuf info
Filename:
MIME Type:
Creator:
Andrey V. Elsukov
Created:
2014-10-27 09:06:01 UTC
Size:
1.00 KB
patch
obsolete
>#define _KERNEL >#include <sys/param.h> >#include <sys/mbuf.h> >#include <sys/systm.h> >#include <sys/socket.h> >#include <netinet/in.h> >#include <netinet/ip.h> >#include <netinet/ip6.h> > > >static void >print_mbuf(const struct mbuf *m) >{ > struct ip6_hdr *ip6; > struct ip *ip; > char bufa[50], bufb[50]; > > printf("mbuf %p: len %u, flags %b\n", m, m->m_len, > m->m_flags, M_FLAG_PRINTF); > if (m->m_len < sizeof(struct ip)) > return; > ip = mtod(m, struct ip *); > printf("mbuf %p: ip_v %u ", m, ip->ip_v); > switch (ip->ip_v) { > case IPVERSION: > printf("%s->%s %u\n", > inet_ntop(AF_INET, &ip->ip_src, bufa, sizeof(ip->ip_src)), > inet_ntop(AF_INET, &ip->ip_dst, bufb, sizeof(ip->ip_dst)), > ip->ip_p); > break; > case IPV6_VERSION >> 4: > ip6 = mtod(m, struct ip6_hdr *); > printf("%s->%s %u\n", > inet_ntop(AF_INET6, &ip6->ip6_src, bufa, > sizeof(ip6->ip6_src)), > inet_ntop(AF_INET6, &ip6->ip6_dst, bufb, > sizeof(ip6->ip6_dst)), ip6->ip6_nxt); > break; > } >} > >int >main(int argc, char**argv) >{ > > > return (0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 194577
: 148695 |
148778
|
148792