return NlHdrPayloadLen(nlh) - GENL_HDRLEN - OVS_HDRLEN;
}
+/*
+ * ---------------------------------------------------------------------------
+ * Returns size of to nfnlmsg attributes.
+ * ---------------------------------------------------------------------------
+ */
+UINT32
+NlNfMsgAttrsLen(const PNL_MSG_HDR nlh)
+{
+ return NlHdrPayloadLen(nlh) - NF_GEN_MSG_HDRLEN - OVS_HDRLEN;
+}
+
/* Netlink message parse. */
/*
*/
typedef struct _OVS_MESSAGE {
NL_MSG_HDR nlMsg;
- GENL_MSG_HDR genlMsg;
+ union {
+ GENL_MSG_HDR genlMsg;
+ NF_GEN_MSG_HDR nfGenMsg;
+ };
OVS_HDR ovsHdr;
/* Variable length nl_attrs follow. */
} OVS_MESSAGE, *POVS_MESSAGE;
+BUILD_ASSERT_DECL(sizeof(GENL_MSG_HDR) == sizeof(NF_GEN_MSG_HDR));
/*
* Structure of an error message sent as a reply from kernel.
UINT32 NlHdrPayloadLen(const PNL_MSG_HDR nlh);
PNL_ATTR NlMsgAttrs(const PNL_MSG_HDR nlh);
UINT32 NlMsgAttrsLen(const PNL_MSG_HDR nlh);
+UINT32 NlNfMsgAttrsLen(const PNL_MSG_HDR nlh);
/* Netlink message parse */
PNL_MSG_HDR NlMsgNext(const PNL_MSG_HDR nlh);
UINT16 type);
BOOLEAN NlAttrParse(const PNL_MSG_HDR nlMsg, UINT32 attrOffset,
UINT32 totalAttrLen, const NL_POLICY policy[],
- const UINT32 numPolicy, PNL_ATTR attrs[],
+ const UINT32 numPolicy, PNL_ATTR attrs[],
UINT32 numAttrs);
BOOLEAN NlAttrParseNested(const PNL_MSG_HDR nlMsg, UINT32 attrOffset,
UINT32 totalAttrLen, const NL_POLICY policy[],
} GENL_MSG_HDR, *PGENL_MSG_HDR;
BUILD_ASSERT_DECL(sizeof(GENL_MSG_HDR) == 4);
+/* Netfilter Generic Message */
+typedef struct _NF_GEN_MSG_HDR {
+ UINT8 nfgenFamily; /* AF_xxx */
+ UINT8 version; /* nfnetlink version */
+ UINT16 resId; /* resource id */
+} NF_GEN_MSG_HDR, *PNF_GEN_MSG_HDR;
+BUILD_ASSERT_DECL(sizeof(NF_GEN_MSG_HDR) == 4);
+
/* Netlink attributes */
typedef struct _NL_ATTR {
UINT16 nlaLen;
#define NLMSG_HDRLEN ((INT) NLMSG_ALIGN(sizeof(NL_MSG_HDR)))
#define GENL_HDRLEN NLMSG_ALIGN(sizeof(GENL_MSG_HDR))
+#define NF_GEN_MSG_HDRLEN NLMSG_ALIGN(sizeof(NF_GEN_MSG_HDR))
#define OVS_HDRLEN NLMSG_ALIGN(sizeof(OVS_HDR))
#define NLA_HDRLEN ((INT) NLA_ALIGN(sizeof(NL_ATTR)))