[ovs-dev] [PATCH 6/9] datapath-windows: Add new NlFillOvsMsgForNfGenMsg method in Netlink.c

Paul Boca pboca at cloudbasesolutions.com
Thu Jun 23 19:49:58 UTC 2016


Acked-by: Paul-Daniel Boca <pboca at cloudbasesolutions.com>

> -----Original Message-----
> From: dev [mailto:dev-bounces at openvswitch.org] On Behalf Of Sairam
> Venugopal
> Sent: Tuesday, June 21, 2016 4:23 AM
> To: dev at openvswitch.org
> Subject: [ovs-dev] [PATCH 6/9] 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 at vmware.com>
> ---
>  datapath-windows/ovsext/Netlink/Netlink.c | 39
> +++++++++++++++++++++++++++++++
>  datapath-windows/ovsext/Netlink/Netlink.h |  4 ++++
>  2 files changed, 43 insertions(+)
> 
> diff --git a/datapath-windows/ovsext/Netlink/Netlink.c b/datapath-
> windows/ovsext/Netlink/Netlink.c
> index a25a22a..6717dd1 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 cce7ec3..9d31641 100644
> --- a/datapath-windows/ovsext/Netlink/Netlink.h
> +++ b/datapath-windows/ovsext/Netlink/Netlink.h
> @@ -94,6 +94,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);
> --
> 2.5.0.windows.1
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev


More information about the dev mailing list