Fix memory leaks in error paths.

Found by Fortify.

Signed-off-by: yinpeijun <yinpeijun@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vtep-ctl: Free error string before return from cmd_remove().

Error string should be freed in all cases.

Found by Coverity.

Signed-off-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
AUTHORS: Add Madhu Challa.

Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: define mcgroup IDs for VPORT and other families

dpif-linux.c makes a nl_lookup_genl_mcgroup(OVS_VPORT_FAMILY) that is not
implemented yet on Windows yet. Multicast group is used currently to
subscribe to events related to VPORTs. Whether the exact same mechanism
would be used is unclear yet.

In the interim, we can implement code to support nl_lookup_genl_mcgroup().
and make progress with the other simpler commands.

In this patch, we define a ID for the VPORT MC group and use it. The IDs for
other families were also defined, but without usage, were seen as unclear.
Hence we define only the VPORT group.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netlink-socket: add support for nl_lookup_genl_mcgroup()

While we work out whether nl_sock_join_mcgroup() will be the mechanism
to support VPORT events, it is easy to add support for
nl_lookup_genl_mcgroup() and make progress on the other commands.

In this patch, we implement support for nl_lookup_genl_mcgroup() only
for the VPORT family though, which is all what dpif-linux.c needs.

Validation:
- A ported dpif-linux.c with epoll code commented out went so far as
to call dp_enumerate! DP Dump commands can be implemented next.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netlink-socket: fix typo to get_sock_pid_from_kernel()

A typo crept in while respinning get_sock_pid_from_kernel() in the previous
patch. Fixing it now. Also, get_sock_pid_from_kernel() doesn't need an OUT
argument. Fixing that too.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Update netlink family IDs

I didn't realize earlier while defining OvsDpInterfaceExt.h that
there are special values defined in netlink-protocol.h for nlmsg_type.
For Eg. NLMSG_ERROR is defined to be 2. In this patch, we update the
values of the family IDs to not clash with the special defines.
I'm using NLMSG_MIN_TYPE as a reference.

All this points to doing family ID lookup from the kernel rather than
returning values from netlink-socket.c. We should move to that model
after we get through the first round of netlink commands.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/flow.h Revert bitfield back to uint64_t.

Using different types for the two bitfields did not work on MSVC, so
reverting back to "64-bit bool" :-)

Reported-by: Saurabh Shah <ssaurabh@vmware.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>