FreeBSD Bugzilla – Attachment 235606 Details for
Bug 237973
pf: implement egress keyword to simplify rules across different hardware
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
routing-monitor.c
routing-monitor.c (text/plain), 1.07 KB, created by
Goran Mekić
on 2022-08-01 14:19:27 UTC
(
hide
)
Description:
routing-monitor.c
Filename:
MIME Type:
Creator:
Goran Mekić
Created:
2022-08-01 14:19:27 UTC
Size:
1.07 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <unistd.h> >#include <sys/socket.h> >#include <net/route.h> > > >int >main() { > int s, n; > char rest[1024]; > struct rt_msghdr hd; > struct msghdr msg; > struct iovec iov[2]; > > memset(&hd, 0, sizeof(hd)); > memset(&msg, 0, sizeof(msg)); > memset(iov, 0, sizeof(iov)); > iov[0].iov_base = &hd; > iov[0].iov_len = sizeof(hd); > iov[1].iov_base = &rest; > iov[1].iov_len = sizeof(rest); > msg.msg_iov = iov; > msg.msg_iovlen = 2; > > s = socket(PF_ROUTE, SOCK_RAW, 0); > for (;;) { > n = recvmsg(s, &msg, 0); > if (n < 0) { > perror("recvmsg failed"); > break; > } > printf("Received message of size: %d.\n", n); > printf("Header size: %lu.\n", sizeof(hd)); > switch(hd.rtm_type) { > case RTM_ADD: > printf("Route added on interface with index %d\n", hd.rtm_index); > break; > case RTM_DELETE: > printf("Route deleted on interface with index %d\n", hd.rtm_index); > break; > } > printf("Flags: %d, addresses: %d\n", hd.rtm_flags, hd.rtm_addrs); > printf("\n"); > } > 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 237973
: 235606