-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnet.h
50 lines (44 loc) · 1.02 KB
/
net.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#define _GNU_SOURCE
/*
For net submodule in linux kernel, got the code while reproducing CVES on kernelCTF
*/
#include <linux/rtnetlink.h>
#include <linux/pkt_sched.h>
#include <linux/netlink.h>
#include <linux/pkt_cls.h>
#include <linux/if_arp.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <errno.h>
#define ELIBX 0x132
#define FAIL_IF(x) if ((x)) { \
printf("\033[0;31m"); \
perror(#x); \
printf("\033[0m\n"); \
return -1; \
}
#define FAIL(x, msg) if ((x)) { \
printf("\033[0;31m"); \
printf("%s\n",msg); \
perror(#x); \
printf("\033[0m\n"); \
exit(-ELIBX); \
}
typedef __u32 u32;
typedef struct tf_msg {
struct nlmsghdr nlh;
struct tcmsg tcm;
#define TC_DATA_LEN 512
char attrbuf[TC_DATA_LEN];
} TM;
// TM == Trafic Message
struct if_msg {
struct nlmsghdr nlh;
struct ifinfomsg ifi;
};
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;