12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/netlink.h>
15 #include <linux/rtnetlink.h>
17 #include <linux/inet_diag.h>
19 #include <linux/audit.h>
22 #include "av_permissions.h"
68 {
RTM_GETDCB, NETLINK_ROUTE_SOCKET__NLMSG_READ },
69 {
RTM_SETDCB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
72 static struct nlmsg_perm nlmsg_tcpdiag_perms[] =
100 {
AUDIT_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ },
101 {
AUDIT_SET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE },
102 {
AUDIT_LIST, NETLINK_AUDIT_SOCKET__NLMSG_READPRIV },
103 {
AUDIT_ADD, NETLINK_AUDIT_SOCKET__NLMSG_WRITE },
104 {
AUDIT_DEL, NETLINK_AUDIT_SOCKET__NLMSG_WRITE },
108 {
AUDIT_USER, NETLINK_AUDIT_SOCKET__NLMSG_RELAY },
110 {
AUDIT_TRIM, NETLINK_AUDIT_SOCKET__NLMSG_WRITE },
121 for (i = 0; i < tabsize/
sizeof(
struct nlmsg_perm); i++)
122 if (nlmsg_type == tab[i].nlmsg_type) {
136 case SECCLASS_NETLINK_ROUTE_SOCKET:
137 err =
nlmsg_perm(nlmsg_type, perm, nlmsg_route_perms,
138 sizeof(nlmsg_route_perms));
141 case SECCLASS_NETLINK_TCPDIAG_SOCKET:
142 err =
nlmsg_perm(nlmsg_type, perm, nlmsg_tcpdiag_perms,
143 sizeof(nlmsg_tcpdiag_perms));
146 case SECCLASS_NETLINK_XFRM_SOCKET:
147 err =
nlmsg_perm(nlmsg_type, perm, nlmsg_xfrm_perms,
148 sizeof(nlmsg_xfrm_perms));
151 case SECCLASS_NETLINK_AUDIT_SOCKET:
156 *perm = NETLINK_AUDIT_SOCKET__NLMSG_RELAY;
158 err =
nlmsg_perm(nlmsg_type, perm, nlmsg_audit_perms,
159 sizeof(nlmsg_audit_perms));