summaryrefslogtreecommitdiff
path: root/include/windows
Commit message (Collapse)AuthorAgeFilesLines
* datapath-windows: Alg support for ftp and tftp in conntrackldejing2022-09-201-0/+1
| | | | | | | | | | | | | | | | | | | | | This patch mainly support alg field in ct action when process ftp/tftp traffic. Tftp with alg mainly parse the tftp packet (IPv4/IPv6), extract connect info from the tftp packet and create the related connection. For ftp, previous version has supported process of ftp traffic. However, previous version regard traffic from or to port 21 as ftp traffic, this is incorrect in some scenario. This version adds alg field in ct for ftp traffic, we could use ct(alg=ftp) to process any ftp traffic from/to any port. IPv4/IPv6. Test cases: 1) ftp ipv4/ipv6 use alg field in the normal and nat scenario. 2) tftp ipv4/ipv6 use alg field in the normal and nat scenario. Signed-off-by: ldejing <ldejing@vmware.com> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
* include/windows/unistd.h: Fixed type cast warning on Windows.Sergey Madaminov2021-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | Currently, the function call type cast for getting file handle produces a warning during OvS compilation on Windows with the following message: ..\include\windows\unistd.h:97:25: warning: cast from function call of type 'intptr_t' (aka 'int') to non-matching type 'HANDLE' (aka 'void *') [-Wbad-function-cast] HANDLE h = (HANDLE) _get_osfhandle(fd); There is a function `LongToHandle()` to perform such cast [1]. But as `intptr_t` can be either `long long` for 64-bit or `int` for 32-bit, instead of clogging the code with `#ifdef` macros to use different cast functions, we can perform this cast directly. Signed-off-by: Sergey Madaminov <sergey.madaminov@gmail.com> Acked-by: Michael Santana <msantana@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ct-dpif, dpif-netlink: Add conntrack timeout policy supportYi-Hung Wei2019-09-262-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch first defines the dpif interface for a datapath to support adding, deleting, getting and dumping conntrack timeout policy. The timeout policy is identified by a 4 bytes unsigned integer in datapath, and it currently support timeout for TCP, UDP, and ICMP protocols. Moreover, this patch provides the implementation for Linux kernel datapath in dpif-netlink. In Linux kernel, the timeout policy is maintained per L3/L4 protocol, and it is identified by 32 bytes null terminated string. On the other hand, in vswitchd, the timeout policy is a generic one that consists of all the supported L4 protocols. Therefore, one of the main task in dpif-netlink is to break down the generic timeout policy into 6 sub policies (ipv4 tcp, udp, icmp, and ipv6 tcp, udp, icmp), and push down the configuration using the netlink API in netlink-conntrack.c. This patch also adds missing symbols in the windows datapath so that the build on windows can pass. Appveyor CI: * https://ci.appveyor.com/project/YiHungWei/ovs/builds/26387754 Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org> Signed-off-by: Justin Pettit <jpettit@ovn.org>
* Add opterr and optopt to Windows headersAlin Gabriel Serdean2018-08-011-1/+1
| | | | | | | | | | | Until now we only had optind defined in the header. Since we are using the BSD getopt variant add opterr and optopt. Fixes: 3ec06ea9c668 ("ovn-nbctl: Initial support for daemon mode.") Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* Fix nonstandard isatty on WindowsAlin Serdean2017-07-061-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of tests are failing, due to the open flow ports being outputted using names instead of numbers. i.e.: http://64.119.130.115/ovs/beb75a40fdc295bfd6521b0068b4cd12f6de507c/testsuite.dir/0464/testsuite.log.gz The issues encountered above is because 'monitor' with 'detach' arguments are specified, that in turn will call 'close_standard_fds' (https://github.com/openvswitch/ovs/blob/master/lib/daemon-unix.c#L472) which will create a duplicate fd over '/dev/null' on Linux and 'nul' on Windows. 'isatty' will be called on those FDs. What POSIX standard says: http://pubs.opengroup.org/onlinepubs/009695399/functions/isatty.html 'The isatty() function shall test whether fildes, an open file descriptor, is associated with a terminal device.' What MSDN says: https://msdn.microsoft.com/en-us/library/f4s0ddew(VS.80).aspx 'The _isatty function determines whether fd is associated with a character device (a terminal, console, printer, or serial port).' This patch adds another check using 'GetConsoleMode' https://msdn.microsoft.com/en-us/library/windows/desktop/ms683167(v=vs.85).aspx which will fail if the handle pointing to the file descriptor is not associated to a console. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Anand Kumar <kumaranand@vmware.com>
* windows: add definition of getpid and getcwdAlin Serdean2017-05-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | getcwd - is used in lib/util.c. getcwd is deprecated on Windows but has _getcwd which is defined in <direct.h>: https://msdn.microsoft.com/en-us/library/sf98bd4y(v=vs.120).aspx getpid - is used in several files (i.e. lib/vlog.c). getpid is also and deprecated and _getpid should be used: https://msdn.microsoft.com/en-us/library/t2y34y40(v=vs.120).aspx The problem using _getpid is that the definition is in <process.h>. A file called process.h also exists in the lib folder. This will mess up includes. An option would be to use a wrapper like we use for lib/string.h(.in) but that would mean to also add it to the automake chain. A simple solution would be to map it to GetCurrentProcessId https://msdn.microsoft.com/en-us/library/windows/desktop/ms683180(v=vs.85).aspx _getpid uses GetCurrentProcessId behind the scenes, casting the result is not required. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org>
* windows: Add definition for EPFNOSUPPORT.Alin Serdean2017-05-051-0/+2
| | | | | | | | | | | The Windows build is failing because EPFNOSUPPORT does not exist. An equivalent is supplied using the WinSock API: WSAEPFNOSUPPORT. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Shashank Ram <rams@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* windows: Add definition of getrusageAlin Serdean2017-03-071-1/+3
| | | | | | | | | | | getrusage is implemented in lib/getrusage-windows.c. This patch just adds its definition to include/windows/sys/resource.h, which serves for files that include <sys/resource.h>. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Sairam Venugopal <vsairam@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* Windows: Add conntrack netfilter netlink definitions to kernel and userspaceSairam Venugopal2016-07-017-0/+6
| | | | | | | | | | | | Include netfilter-conntrack header definitions. This will be used by Windows userspace for adding debugging support in Conntrack. Few of these files are intentionally left blank to avoid removing #includes in userspace. New file - OvsDpInterfaceCtExt.h has been defined similar to OvsDpInterfaceExt.h to be reused by userspace and kernel. Signed-off-by: Sairam Venugopal <vsairam@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* windefs: Redefine INET6_ADDRSTRLEN for Windows.Gurucharan Shetty2015-10-161-0/+3
| | | | | | | | | | Windows has INET6_ADDRSTRLEN defined as 65 whereas POSIX has it as 46. This difference causes a unit test failure as the test 'tunnel_push_pop' was looking at o/p format based on the length of INET6_ADDRSTRLEN. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Joe Stringer <joestringer@nicira.com>
* Add support for connection tracking helper/ALGs.Joe Stringer2015-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | This patch adds support for specifying a "helper" or ALG to assist connection tracking for protocols that consist of multiple streams. Initially, only support for FTP is included. Below is an example set of flows to allow FTP control connections from port 1->2 to establish active data connections in the reverse direction: table=0,priority=1,action=drop table=0,arp,action=normal table=0,in_port=1,tcp,action=ct(alg=ftp,commit),2 table=0,in_port=2,tcp,ct_state=-trk,action=ct(table=1) table=1,in_port=2,tcp,ct_state=+trk+est,action=1 table=1,in_port=2,tcp,ct_state=+trk+rel,action=ct(commit),1 Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windows: Avoid OVS_UNUSED in Windows stubs for syslog.h.Alin Serdean2015-07-011-4/+3
| | | | | | | | | Currently OVS_UNUSED is defined in compiler.h since syslog.h is a standalone wrapper remove it from the parameters. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Eitan Eliahu <eliahue@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* windows/syslog: Remove duplicate definition.Gurucharan Shetty2015-03-051-1/+0
| | | | | Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* vlog: Ability to override the default log facility.Gurucharan Shetty2015-01-281-0/+13
| | | | | | | | | | | | | | | When Open vSwitch is run in hundreds of hypervisors, it is useful to collect log messages through log collectors. To collect log messages like this, it is useful to log them in a particular RFC5424 facility in the local system. The log collectors can then be used to collect logs anytime desired. This commit provides a sysadmin the ability to specify the facility through which the log messages are logged. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Fix build break in ofproto/tunnel.c for windows platform.Saurabh Shah2014-11-201-0/+1
| | | | | | | | | | The breakage was introduced by commit: a36de779 ("openvswitch: Userspace tunneling."). Reported-by: Edwin Chiu <echiu@nicira.com> Signed-off-by: Saurabh Shah <ssaurabh@vmware.com> Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* netinet/in.h: Add definition for IPPROTO_GRE.Gurucharan Shetty2014-08-181-0/+22
| | | | | | | | | Commit b7ea2d480338(Extend OVS IPFIX exporter to export tunnel headers) added a usage for IPROTO_GRE. But that does not look available in any Visual Studio headers. So add it. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Prepare include headersAlin Serdean2014-08-134-0/+60
| | | | | | | Preparing the include headers needed to compile dpif-linux.c with MSVC. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* No newline at end of fileAlin Serdean2014-08-132-2/+2
| | | | | | | Adding newline at end of the following files: packet.h, uio.h. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Add defines, enums and headers for MSVCAlin Serdean2014-07-295-0/+163
| | | | | | | | | | | Add defines needed to compile netlink-socket.c and netlink.c. Add a wrapper and the functionality behind it for syconf. Add the newly created files to the noinst_HEADERS in windows/automake.mk Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* system-stats: Port for Windows.Gurucharan Shetty2014-03-172-0/+1
| | | | | | | | This does not provide us all the functionality that is available in Linux. But should be a start. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windefs: srandom() and random() for windows.Gurucharan Shetty2014-03-171-0/+3
| | | | | | | | Windows does not have a srandom() and random(). But it does have a srand() and rand(). We use these functions in sflow code. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* strsep: Copy from netbsd.Gurucharan Shetty2014-03-171-0/+2
| | | | | | | Windows does not have a strsep. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* sflow: Include the windefs.h header for windows.Gurucharan Shetty2014-03-171-0/+1
| | | | | | | | sflow.h uses u_int32_t that needs windefs.h for compilation in visual studio. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windows/unistd: Add definitions for STD*_FILENO.Gurucharan Shetty2014-03-171-0/+5
| | | | Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* windefs: Include the library advapi32.Gurucharan Shetty2014-03-171-0/+2
| | | | | | | | advapi32 is needed by multiple functions So include it in a common place. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windows/sys: Define sa_family_t for easy compilation.Gurucharan Shetty2014-03-131-0/+22
| | | | Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* windefs: Add definition for pid_t.Gurucharan Shetty2014-03-131-0/+2
| | | | Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* windows/net: Definition for IFNAMSIZ.Gurucharan Shetty2014-03-131-0/+24
| | | | | Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windows/netinet: Copy ip6.h and icmp6.h from netbsd.Gurucharan Shetty2014-03-132-0/+841
| | | | | | | | | | | | | | | | There are a few structure definitions that is used from these headers. So copy them from the netbsd repo. The following changes have been made on top of it: * The keyword "__packed" has been removed from the headers as the corresponding Linux headers don't do packing. * #if BYTE_ORDER == 'X' macros have been replaced by CONSTANT_HTONx(). * code inside #ifdef _KERNEL has been deleted. * code inside #ifdef ICMP6_STRINGS has been deleted. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windows/netinet: Add some #defines needed for Windows.Gurucharan Shetty2014-03-131-0/+25
| | | | | Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ovsdb: fsync() for Windows.Gurucharan Shetty2014-03-131-0/+21
| | | | | | | | There is no fsync() in Windows. But there is a _commit() which does the same thing. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* ovsdb-server: Truncate file for Windows.Gurucharan Shetty2014-03-121-0/+1
| | | | | | | | There is no ftruncate() in visual studio. There is a _chsize_s() which has a similar functionality. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* windows: Add stub headers for windows.Gurucharan Shetty2014-03-1119-0/+18
| | | | | | | | | Windows does not have a bunch of headers that are available in Linux. Instead of littering the code with #ifndef _WIN32, add stub headers. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* getrusage-windows: getrusage() for Windows.Gurucharan Shetty2014-03-062-0/+52
| | | | | | | | | | | | | | | | | | | We use getrusage mainly to get user CPU time and system CPU time. Windows has a GetProcessTimes and GetThreadTimes that does the same job. So use them. We also use getrusage to get page faults. Use GetProcessMemoryInfo() for that. We also get number of context switches, block i/o times and use it for debug information when we wake up from poll_block late. I haven't found functions for that in Windows. We only use it for debug information, so it should be okay not implementing it. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Co-authored-by: Linda Sun <lsun@vmware.com> Signed-off-by: Linda Sun <lsun@vmware.com> Acked-by: Ben Pfaff <blp@nicira.com>
* getopt_long: Copy over the implementation from netbsd.Gurucharan Shetty2014-01-272-2/+65
| | | | | | | | | | | | | | | | | | | Windows does not have a getopt_long function. This commit copies over the getopt_long implementation from netbsd with some minor modifications and is used only on Windows platform. Modifications on top of the version in NetBSD repo. * Remove header files not available in Visual Studio. * Remove some unwanted #defines. * Add Open vSwitch specific header files like config.h, vlog.h, util.h * Add the following #define's define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) define _DIAGASSERT(q) ovs_assert(q) define warnx VLOG_WARN * Add extern declaration in getopt.h for optarg, optind. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* syslog: Provide stub functions for openlog and syslog.Gurucharan Shetty2014-01-241-0/+11
| | | | | | | | | | | | | | One option to implement openlog and syslog functionality in Windows is to use windows event logger. But it looks like it involves changing registry settings and in general looks complicated. For the time being, do nothing for syslog. All the information needed for debugging will be present through the 'file' option anyways. We can start OVS daemons on Windows with "-vfile:info -vsyslog:off". Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* syslog: Add LOG_LOCALX definitions.Gurucharan Shetty2014-01-241-0/+9
| | | | | | | LOG_LOCAL0 is used in lib/vlog.c. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Add common definitions for Windows builds.Alin Serdean2013-12-273-0/+75
Signed-off-by: Alin Serdean <aserdean at cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@nicira.com>