diff options
author | Sairam Venugopal <vsairam@vmware.com> | 2016-07-01 13:49:27 -0700 |
---|---|---|
committer | Gurucharan Shetty <guru@ovn.org> | 2016-07-01 20:52:04 -0700 |
commit | d115da85482f3cb534651899831fba177714aec5 (patch) | |
tree | 25f312bdb64c89b1c8360442d530a7412ae4ea6a /datapath-windows/ovsext | |
parent | 9f8407b9027df9614909bfdee49ab43f0612f39b (diff) | |
download | openvswitch-d115da85482f3cb534651899831fba177714aec5.tar.gz |
datapath-windows: Add new NlFillOvsMsgForNfGenMsg method in Netlink.c
Create a new method to create and fill OvsMessage with NfGenMsg. This will
be used for sending Netfilter based Netlink messages.
Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext')
-rw-r--r-- | datapath-windows/ovsext/Netlink/Netlink.c | 39 | ||||
-rw-r--r-- | datapath-windows/ovsext/Netlink/Netlink.h | 4 |
2 files changed, 43 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Netlink/Netlink.c b/datapath-windows/ovsext/Netlink/Netlink.c index ccf9ec1f0..24322053c 100644 --- a/datapath-windows/ovsext/Netlink/Netlink.c +++ b/datapath-windows/ovsext/Netlink/Netlink.c @@ -73,6 +73,45 @@ NlFillOvsMsg(PNL_BUFFER nlBuf, UINT16 nlmsgType, /* * --------------------------------------------------------------------------- + * Prepare netlink message headers. This API adds + * NL_MSG_HDR + GENL_HDR + OVS_HDR to the tail of input NLBuf. + * Attributes should be added by caller. + * --------------------------------------------------------------------------- + */ +BOOLEAN +NlFillOvsMsgForNfGenMsg(PNL_BUFFER nlBuf, UINT16 nlmsgType, + UINT16 nlmsgFlags, UINT32 nlmsgSeq, + UINT32 nlmsgPid, UINT8 nfgenFamily, + UINT8 nfGenVersion, UINT32 dpNo) +{ + BOOLEAN writeOk; + OVS_MESSAGE msgOut; + UINT32 offset = NlBufSize(nlBuf); + + /* To keep compiler happy for release build. */ + UNREFERENCED_PARAMETER(offset); + ASSERT(NlBufAt(nlBuf, offset, 0) != 0); + + msgOut.nlMsg.nlmsgType = nlmsgType; + msgOut.nlMsg.nlmsgFlags = nlmsgFlags; + msgOut.nlMsg.nlmsgSeq = nlmsgSeq; + msgOut.nlMsg.nlmsgPid = nlmsgPid; + msgOut.nlMsg.nlmsgLen = sizeof(struct _OVS_MESSAGE); + + msgOut.nfGenMsg.nfgenFamily = nfgenFamily; + msgOut.nfGenMsg.version = nfGenVersion; + msgOut.nfGenMsg.resId = 0; + + msgOut.ovsHdr.dp_ifindex = dpNo; + + writeOk = NlMsgPutTail(nlBuf, (PCHAR)(&msgOut), + sizeof (struct _OVS_MESSAGE)); + + return writeOk; +} + +/* + * --------------------------------------------------------------------------- * Prepare NL_MSG_HDR only. This API appends a NL_MSG_HDR to the tail of * input NlBuf. * --------------------------------------------------------------------------- diff --git a/datapath-windows/ovsext/Netlink/Netlink.h b/datapath-windows/ovsext/Netlink/Netlink.h index 5261b9ece..363f57501 100644 --- a/datapath-windows/ovsext/Netlink/Netlink.h +++ b/datapath-windows/ovsext/Netlink/Netlink.h @@ -95,6 +95,10 @@ BOOLEAN NlFillOvsMsg(PNL_BUFFER nlBuf, UINT16 nlmsgType, UINT16 nlmsgFlags, UINT32 nlmsgSeq, UINT32 nlmsgPid, UINT8 genlCmd, UINT8 genlVer, UINT32 dpNo); +BOOLEAN NlFillOvsMsgForNfGenMsg(PNL_BUFFER nlBuf, UINT16 nlmsgType, + UINT16 nlmsgFlags, UINT32 nlmsgSeq, + UINT32 nlmsgPid, UINT8 nfgenFamily, + UINT8 nfGenVersion, UINT32 dpNo); BOOLEAN NlFillNlHdr(PNL_BUFFER nlBuf, UINT16 nlmsgType, UINT16 nlmsgFlags, UINT32 nlmsgSeq, UINT32 nlmsgPid); |