netlink: add decoding of NETLINK_ROUTE message types

* xlat/nl_route_types.in: New file.
* netlink.c: Include <linux/rtnetlink.h> and "xlat/nl_route_types.h".
(nlmsg_types): Add NETLINK_ROUTE.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
This commit is contained in:
Дмитрий Левин 2017-06-04 16:43:48 +00:00
parent c5db18d946
commit d5435f74ed
2 changed files with 73 additions and 0 deletions

View File

@ -31,10 +31,12 @@
#include <sys/socket.h>
#include <linux/audit.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include "xlat/netlink_flags.h"
#include "xlat/netlink_protocols.h"
#include "xlat/netlink_types.h"
#include "xlat/nl_audit_types.h"
#include "xlat/nl_route_types.h"
#include "xlat/nl_sock_diag_types.h"
#undef NLMSG_HDRLEN
@ -96,6 +98,7 @@ static const struct {
const char *const dflt;
} nlmsg_types[] = {
[NETLINK_AUDIT] = { nl_audit_types, "AUDIT_???" },
[NETLINK_ROUTE] = { nl_route_types, "RTM_???" },
[NETLINK_SOCK_DIAG] = { nl_sock_diag_types, "SOCK_DIAG_???" }
};

70
xlat/nl_route_types.in Normal file
View File

@ -0,0 +1,70 @@
RTM_NEWLINK 16
RTM_DELLINK 17
RTM_GETLINK 18
RTM_SETLINK 19
RTM_NEWADDR 20
RTM_DELADDR 21
RTM_GETADDR 22
RTM_NEWROUTE 24
RTM_DELROUTE 25
RTM_GETROUTE 26
RTM_NEWNEIGH 28
RTM_DELNEIGH 29
RTM_GETNEIGH 30
RTM_NEWRULE 32
RTM_DELRULE 33
RTM_GETRULE 34
RTM_NEWQDISC 36
RTM_DELQDISC 37
RTM_GETQDISC 38
RTM_NEWTCLASS 40
RTM_DELTCLASS 41
RTM_GETTCLASS 42
RTM_NEWTFILTER 44
RTM_DELTFILTER 45
RTM_GETTFILTER 46
RTM_NEWACTION 48
RTM_DELACTION 49
RTM_GETACTION 50
RTM_NEWPREFIX 52
RTM_GETPREFIX 54
RTM_GETMULTICAST 58
RTM_GETANYCAST 62
RTM_NEWNEIGHTBL 64
RTM_GETNEIGHTBL 66
RTM_SETNEIGHTBL 67
RTM_NEWNDUSEROPT 68
RTM_NEWADDRLABEL 72
RTM_DELADDRLABEL 73
RTM_GETADDRLABEL 74
RTM_GETDCB 78
RTM_SETDCB 79
RTM_NEWNETCONF 80
RTM_GETNETCONF 82
RTM_NEWMDB 84
RTM_DELMDB 85
RTM_GETMDB 86
RTM_NEWNSID 88
RTM_DELNSID 89
RTM_GETNSID 90
RTM_NEWSTATS 92
RTM_GETSTATS 94