summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Datapath.c
diff options
context:
space:
mode:
authorSairam Venugopal <vsairam@vmware.com>2016-07-25 17:04:42 -0700
committerGurucharan Shetty <guru@ovn.org>2016-07-29 08:38:39 -0700
commit9c16b94108c85bd7f9b5a8e2a985415a802b7ad0 (patch)
tree2d6f96bcefc4e61d54dc7d116cdba70f74f9b46c /datapath-windows/ovsext/Datapath.c
parent2df52bf68ab62ce8ffecd189f66180b26d98b428 (diff)
downloadopenvswitch-9c16b94108c85bd7f9b5a8e2a985415a802b7ad0.tar.gz
datapath-windows: Update OvsReadEventCmdHandler in Datapath.c to support different events
OvsReadEventCmdHandler must now reflect the right event being read. If the event is a Conntrack related event, then convert the entry to netlink format and send it to userspace. If it's Vport event, retain the existing workflow. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Paul Boca <pboca@cloudbasesolutions.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Datapath.c')
-rw-r--r--datapath-windows/ovsext/Datapath.c66
1 files changed, 50 insertions, 16 deletions
diff --git a/datapath-windows/ovsext/Datapath.c b/datapath-windows/ovsext/Datapath.c
index f9f965c26..745cdb695 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -1672,14 +1672,12 @@ static NTSTATUS
OvsReadEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
UINT32 *replyLen)
{
-#ifdef DBG
POVS_MESSAGE msgOut = (POVS_MESSAGE)usrParamsCtx->outputBuffer;
+ POVS_MESSAGE msgIn = (POVS_MESSAGE)usrParamsCtx->inputBuffer;
POVS_OPEN_INSTANCE instance =
(POVS_OPEN_INSTANCE)usrParamsCtx->ovsInstance;
-#endif
NL_BUFFER nlBuf;
NTSTATUS status;
- OVS_VPORT_EVENT_ENTRY eventEntry;
ASSERT(usrParamsCtx->devOp == OVS_READ_DEV_OP);
@@ -1692,21 +1690,57 @@ OvsReadEventCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx,
/* Output buffer has been validated while validating read dev op. */
ASSERT(msgOut != NULL && usrParamsCtx->outputLength >= sizeof *msgOut);
- NlBufInit(&nlBuf, usrParamsCtx->outputBuffer, usrParamsCtx->outputLength);
+ if (instance->protocol == NETLINK_NETFILTER) {
+ if (!instance->mcastMask) {
+ status = STATUS_SUCCESS;
+ *replyLen = 0;
+ goto cleanup;
+ }
- /* remove an event entry from the event queue */
- status = OvsRemoveVportEventEntry(usrParamsCtx->ovsInstance,
- &eventEntry);
- if (status != STATUS_SUCCESS) {
- /* If there were not elements, read should return no data. */
- status = STATUS_SUCCESS;
- *replyLen = 0;
- goto cleanup;
- }
+ OVS_CT_EVENT_ENTRY ctEventEntry;
+ status = OvsRemoveCtEventEntry(usrParamsCtx->ovsInstance,
+ &ctEventEntry);
- status = OvsPortFillInfo(usrParamsCtx, &eventEntry, &nlBuf);
- if (status == NDIS_STATUS_SUCCESS) {
- *replyLen = NlBufSize(&nlBuf);
+ if (status != STATUS_SUCCESS) {
+ /* If there were not elements, read should return no data. */
+ status = STATUS_SUCCESS;
+ *replyLen = 0;
+ goto cleanup;
+ }
+
+ status = OvsCreateNlMsgFromCtEntry(&ctEventEntry.entry,
+ usrParamsCtx->outputBuffer,
+ usrParamsCtx->outputLength,
+ ctEventEntry.type,
+ msgIn->nlMsg.nlmsgSeq,
+ usrParamsCtx->ovsInstance->pid,
+ NFNETLINK_V0,
+ gOvsSwitchContext->dpNo);
+ if (status == NDIS_STATUS_SUCCESS) {
+ *replyLen = msgOut->nlMsg.nlmsgLen;
+ }
+ } else if (instance->protocol == NETLINK_GENERIC) {
+ NlBufInit(&nlBuf,
+ usrParamsCtx->outputBuffer,
+ usrParamsCtx->outputLength);
+
+ OVS_VPORT_EVENT_ENTRY eventEntry;
+ /* remove vport event entry from the vport event queue */
+ status = OvsRemoveVportEventEntry(usrParamsCtx->ovsInstance,
+ &eventEntry);
+ if (status != STATUS_SUCCESS) {
+ /* If there were not elements, read should return no data. */
+ status = STATUS_SUCCESS;
+ *replyLen = 0;
+ goto cleanup;
+ }
+
+ status = OvsPortFillInfo(usrParamsCtx, &eventEntry, &nlBuf);
+ if (status == NDIS_STATUS_SUCCESS) {
+ *replyLen = NlBufSize(&nlBuf);
+ }
+ } else {
+ status = STATUS_INVALID_PARAMETER;
}
cleanup: