Kernel: Enable processes with corresponding UIDs to utilise netlink, and optimise netlink functionality
This commit is contained in:
@@ -4,17 +4,43 @@
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/sock.h>
|
||||
#include <linux/net.h>
|
||||
|
||||
#define KSU_NETLINK_PROTOCOL 2
|
||||
#define KSU_NETLINK_CMD_MANUAL_SU 50
|
||||
#define KSU_NETLINK_PROTOCOL 11
|
||||
|
||||
struct ksu_netlink_msg {
|
||||
int cmd;
|
||||
#define KSU_NETLINK_CMD_MANUAL_SU 100
|
||||
|
||||
struct ksu_netlink_hdr {
|
||||
int cmd; // Command ID
|
||||
int result; // Result code (output)
|
||||
};
|
||||
|
||||
#ifdef CONFIG_KSU_MANUAL_SU
|
||||
struct ksu_netlink_manual_su {
|
||||
struct ksu_netlink_hdr hdr;
|
||||
int option;
|
||||
uid_t target_uid;
|
||||
pid_t target_pid;
|
||||
char token_buffer[33];
|
||||
int result;
|
||||
};
|
||||
#endif
|
||||
|
||||
union ksu_netlink_msg {
|
||||
struct ksu_netlink_hdr hdr;
|
||||
#ifdef CONFIG_KSU_MANUAL_SU
|
||||
struct ksu_netlink_manual_su manual_su;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef int (*ksu_netlink_handler_t)(struct sk_buff *skb, struct nlmsghdr *nlh, void *msg_data);
|
||||
typedef bool (*ksu_netlink_perm_check_t)(uid_t uid);
|
||||
|
||||
struct ksu_netlink_cmd_handler {
|
||||
int cmd;
|
||||
size_t msg_size;
|
||||
const char *name;
|
||||
ksu_netlink_handler_t handler;
|
||||
ksu_netlink_perm_check_t perm_check;
|
||||
};
|
||||
|
||||
int ksu_netlink_init(void);
|
||||
|
||||
Reference in New Issue
Block a user