diff options
-rw-r--r-- | include/libnetfilter_log/libnetfilter_log.h | 1 | ||||
-rw-r--r-- | include/libnetfilter_log/linux_nfnetlink_log.h | 1 | ||||
-rw-r--r-- | src/libnetfilter_log.c | 9 |
3 files changed, 11 insertions, 0 deletions
diff --git a/include/libnetfilter_log/libnetfilter_log.h b/include/libnetfilter_log/libnetfilter_log.h index 5615daf..4e5d763 100644 --- a/include/libnetfilter_log/libnetfilter_log.h +++ b/include/libnetfilter_log/libnetfilter_log.h @@ -58,6 +58,7 @@ extern struct nfulnl_msg_packet_hw *nflog_get_packet_hw(struct nflog_data *nfad) extern int nflog_get_payload(struct nflog_data *nfad, char **data); extern char *nflog_get_prefix(struct nflog_data *nfad); extern int nflog_get_uid(struct nflog_data *nfad, u_int32_t *uid); +extern int nflog_get_gid(struct nflog_data *nfad, u_int32_t *gid); extern int nflog_get_seq(struct nflog_data *nfad, u_int32_t *seq); extern int nflog_get_seq_global(struct nflog_data *nfad, u_int32_t *seq); diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h index 12787e7..f8e174d 100644 --- a/include/libnetfilter_log/linux_nfnetlink_log.h +++ b/include/libnetfilter_log/linux_nfnetlink_log.h @@ -53,6 +53,7 @@ enum nfulnl_attr_type { NFULA_UID, /* user id of socket */ NFULA_SEQ, /* instance-local sequence number */ NFULA_SEQ_GLOBAL, /* global sequence number */ + NFULA_GID, /* group id of socket */ __NFULA_MAX }; diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c index 95537d8..a3bd435 100644 --- a/src/libnetfilter_log.c +++ b/src/libnetfilter_log.c @@ -442,6 +442,15 @@ int nflog_get_uid(struct nflog_data *nfad, u_int32_t *uid) return 0; } +int nflog_get_gid(struct nflog_data *nfad, u_int32_t *gid) +{ + if (!nfnl_attr_present(nfad->nfa, NFULA_GID)) + return -1; + + *gid = ntohl(nfnl_get_data(nfad->nfa, NFULA_GID, u_int32_t)); + return 0; +} + int nflog_get_seq(struct nflog_data *nfad, u_int32_t *seq) { if (!nfnl_attr_present(nfad->nfa, NFULA_SEQ)) |