#include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <linux/rtnetlink.h> int main() { int soc; struct sockaddr_nl sa; int n; char buf[4096]; struct nlmsghdr *nlhdr; char ipaddrstr[48]; soc = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); memset(&sa, 0, sizeof(sa)); sa.nl_family = AF_NETLINK