├── debian ├── compat ├── dirs ├── openvswitch-common.docs ├── source │ └── format ├── openvswitch-pki.dirs ├── openvswitch-common.dirs ├── openvswitch-ipsec.dirs ├── openvswitch-test.dirs ├── openvswitch-controller.dirs ├── openvswitch-controller.install ├── ovsdbmonitor.manpages ├── openvswitch-controller.manpages ├── ovsdbmonitor.install ├── openvswitch-datapath-source.dirs ├── openvswitch-switch.dirs ├── openvswitch-ipsec.install ├── python-openvswitch.dirs ├── openvswitch-test.manpages ├── python-openvswitch.install ├── openvswitch-test.install ├── openvswitch-switch.links ├── openvswitch-switch.manpages ├── dkms.conf.in ├── openvswitch-common.install ├── openvswitch-controller.README.Debian ├── openvswitch-common.manpages ├── openvswitch-switch.template ├── openvswitch-datapath-dkms.prerm ├── openvswitch-datapath-source.install ├── openvswitch-switch.logrotate ├── openvswitch-datapath-source.copyright ├── .gitignore ├── openvswitch-switch.install ├── openvswitch-datapath-dkms.postinst ├── openvswitch-datapath-module-_KVERS_.postinst.modules.in ├── control.modules.in ├── openvswitch-datapath-source.README.Debian ├── rules.modules ├── openvswitch-controller.default ├── openvswitch-controller.postrm ├── openvswitch-pki.postrm ├── openvswitch-switch.postrm └── openvswitch-pki.postinst ├── python ├── ovs │ ├── .gitignore │ ├── __init__.py │ ├── db │ │ ├── __init__.py │ │ └── error.py │ ├── dirs.py │ ├── dirs.py.template │ ├── timeval.py │ └── process.py ├── ovstest │ └── __init__.py └── compat │ └── automake.mk ├── include ├── openflow │ ├── .gitignore │ └── openflow.h ├── .gitignore ├── linux │ └── automake.mk ├── openvswitch │ └── automake.mk ├── automake.mk └── sparse │ ├── automake.mk │ ├── arpa │ └── inet.h │ ├── assert.h │ └── sys │ └── wait.h ├── xenserver ├── .gitignore ├── etc_logrotate.d_openvswitch ├── usr_share_openvswitch_scripts_sysconfig.template ├── etc_profile.d_openvswitch.sh └── automake.mk ├── ofproto ├── .gitignore ├── automake.mk ├── collectors.h ├── names.c ├── pktbuf.h ├── pinsched.h ├── ofproto-dpif-unixctl.man └── fail-open.h ├── ovsdb ├── ovsdbmonitor │ ├── .gitignore │ ├── ovsdbmonitor.desktop │ ├── COPYING │ ├── ovsdbmonitor.1 │ ├── ovsdbmonitor.in │ ├── OVEStandard.py │ └── OVELogger.py ├── .gitignore ├── remote-active.man ├── remote-passive.man └── query.h ├── third-party ├── .gitignore ├── automake.mk └── README ├── boot.sh ├── utilities ├── bugtool │ ├── .gitignore │ ├── ovs-bugtool-bond-show │ ├── ovs-bugtool-cfm-show │ ├── ovs-bugtool-lacp-show │ ├── ovs-bugtool-memory-show │ ├── ovs-bugtool-coverage-show │ ├── ovs-bugtool-vsctl-show │ ├── ovs-bugtool-ovsdb-dump │ ├── plugins │ │ ├── kernel-info │ │ │ └── openvswitch.xml │ │ ├── system-configuration │ │ │ └── openvswitch.xml │ │ ├── system-configuration.xml │ │ └── system-logs │ │ │ └── openvswitch.xml │ ├── ovs-bugtool-daemons-ver │ ├── ovs-bugtool-tc-class-show │ └── ovs-bugtool.8.in ├── .gitignore ├── ovs-pcap.1.in ├── ovs-tcpundump.1.in ├── ovs-vlan-bugs.man ├── ovs-parse-backtrace.8 └── ovs-parse-leaks.8 ├── lib ├── ssl-bootstrap-syn.man ├── unixctl-syn.man ├── common-syn.man ├── daemon-syn.man ├── ssl-syn.man ├── .gitignore ├── vlog-syn.man ├── common.man ├── memory-unixctl.man ├── vswitch-idl.ann ├── dh1024.pem ├── unixctl.man ├── coverage-unixctl.man ├── vconn-active.man ├── dh2048.pem ├── leak-checker.man ├── ssl-peer-ca-cert.man ├── vconn-passive.man ├── entropy.h ├── ofp-version.man ├── dhparams.h ├── valgrind.h ├── string.c ├── sort.h ├── lockfile.h ├── backtrace.h ├── pcap.h ├── dummy.h ├── ofp-version-opt.h ├── dh4096.pem ├── random.h ├── ssl-bootstrap.man ├── ofp-version-opt.c ├── dirs.h ├── route-table.h ├── netdev-linux.h ├── netdev-vport.h ├── route-table-stub.c ├── signals.h ├── aes128.h ├── ssl.man ├── timer.c ├── csum.h ├── stream-fd.h ├── string.h ├── command-line.h ├── dummy.c ├── autopath.h ├── fatal-signal.h ├── learn.h ├── type-props.h ├── sat-math.h ├── token-bucket.h ├── ofp-print.h └── multipath.h ├── datapath ├── .gitignore ├── linux │ ├── compat │ │ ├── reciprocal_div.c │ │ ├── include │ │ │ ├── asm │ │ │ │ └── percpu.h │ │ │ ├── linux │ │ │ │ ├── compiler.h │ │ │ │ ├── compiler-gcc.h │ │ │ │ ├── poison.h │ │ │ │ ├── stddef.h │ │ │ │ ├── icmp.h │ │ │ │ ├── icmpv6.h │ │ │ │ ├── ipv6.h │ │ │ │ ├── cpumask.h │ │ │ │ ├── types.h │ │ │ │ ├── bug.h │ │ │ │ ├── inetdevice.h │ │ │ │ ├── if_arp.h │ │ │ │ ├── log2.h │ │ │ │ ├── udp.h │ │ │ │ ├── tcp.h │ │ │ │ ├── ip.h │ │ │ │ ├── rcupdate.h │ │ │ │ ├── netfilter_ipv4.h │ │ │ │ ├── if.h │ │ │ │ ├── if_ether.h │ │ │ │ ├── genetlink.h │ │ │ │ ├── err.h │ │ │ │ ├── netfilter_bridge.h │ │ │ │ ├── rculist.h │ │ │ │ ├── slab.h │ │ │ │ ├── kobject.h │ │ │ │ ├── in.h │ │ │ │ ├── jiffies.h │ │ │ │ ├── netlink.h │ │ │ │ ├── etherdevice.h │ │ │ │ ├── net.h │ │ │ │ ├── reciprocal_div.h │ │ │ │ └── mutex.h │ │ │ └── net │ │ │ │ ├── sock.h │ │ │ │ ├── ip.h │ │ │ │ ├── protocol.h │ │ │ │ ├── netns │ │ │ │ └── generic.h │ │ │ │ ├── inet_frag.h │ │ │ │ ├── route.h │ │ │ │ ├── dst.h │ │ │ │ ├── ipv6.h │ │ │ │ └── checksum.h │ │ ├── skbuff-openvswitch.c │ │ ├── kmemdup.c │ │ ├── ip_output-openvswitch.c │ │ ├── dev-openvswitch.c │ │ └── time.c │ ├── Makefile.in │ ├── .gitignore │ └── Kbuild.in ├── Makefile.am ├── genl_exec.h ├── vport-internal_dev.h ├── vport-capwap.h ├── Modules.mk └── vport-netdev.h ├── vswitchd ├── .gitignore ├── xenserver.h ├── system-stats.h ├── bridge.h └── vswitch.gv ├── rhel ├── .gitignore ├── usr_lib_systemd_system_openvswitch.service ├── etc_logrotate.d_openvswitch ├── usr_share_openvswitch_scripts_sysconfig.template └── etc_sysconfig_network-scripts_ifdown-ovs ├── tests ├── openssl.supp ├── glibc.supp ├── idltest.ann ├── heap.at ├── ovsdb-macros.at ├── ovsdb-column.at ├── .gitignore ├── classifier.at ├── vconn.at ├── timeval.at ├── uuidfilt.pl ├── choose-port.pl ├── valgrind-wrapper.in ├── test-file_name.c ├── uuid.at ├── test-uuid.c ├── ovsdb-monitor-sort.pl ├── test-strtok_r.c ├── autopath.at ├── check-structs.at ├── atlocal.in └── test-vlog.py ├── README-gcov ├── .gitignore └── NOTICE /debian/compat: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/sbin 3 | -------------------------------------------------------------------------------- /debian/openvswitch-common.docs: -------------------------------------------------------------------------------- 1 | FAQ 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /python/ovs/.gitignore: -------------------------------------------------------------------------------- 1 | version.py 2 | -------------------------------------------------------------------------------- /include/openflow/.gitignore: -------------------------------------------------------------------------------- 1 | *.hstamp 2 | -------------------------------------------------------------------------------- /xenserver/.gitignore: -------------------------------------------------------------------------------- 1 | /openvswitch-xen.spec 2 | -------------------------------------------------------------------------------- /debian/openvswitch-pki.dirs: -------------------------------------------------------------------------------- 1 | /var/lib/openvswitch 2 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | -------------------------------------------------------------------------------- /ofproto/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/.gitignore: -------------------------------------------------------------------------------- 1 | /ovsdbmonitor.py 2 | -------------------------------------------------------------------------------- /third-party/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | -------------------------------------------------------------------------------- /boot.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | autoreconf --install --force 3 | -------------------------------------------------------------------------------- /debian/openvswitch-common.dirs: -------------------------------------------------------------------------------- 1 | var/log/openvswitch 2 | -------------------------------------------------------------------------------- /debian/openvswitch-ipsec.dirs: -------------------------------------------------------------------------------- 1 | usr/share/openvswitch/scripts 2 | -------------------------------------------------------------------------------- /debian/openvswitch-test.dirs: -------------------------------------------------------------------------------- 1 | usr/share/pyshared/ovstest/ 2 | -------------------------------------------------------------------------------- /debian/openvswitch-controller.dirs: -------------------------------------------------------------------------------- 1 | etc/openvswitch-controller 2 | -------------------------------------------------------------------------------- /debian/openvswitch-controller.install: -------------------------------------------------------------------------------- 1 | usr/bin/ovs-controller 2 | -------------------------------------------------------------------------------- /debian/ovsdbmonitor.manpages: -------------------------------------------------------------------------------- 1 | ovsdb/ovsdbmonitor/ovsdbmonitor.1 2 | -------------------------------------------------------------------------------- /python/ovs/__init__.py: -------------------------------------------------------------------------------- 1 | # This file intentionally left blank. 2 | -------------------------------------------------------------------------------- /python/ovs/db/__init__.py: -------------------------------------------------------------------------------- 1 | # This file intentionally left blank. 2 | -------------------------------------------------------------------------------- /python/ovstest/__init__.py: -------------------------------------------------------------------------------- 1 | # This file intentionally left blank. 2 | -------------------------------------------------------------------------------- /utilities/bugtool/.gitignore: -------------------------------------------------------------------------------- 1 | /ovs-bugtool 2 | /ovs-bugtool.8 3 | -------------------------------------------------------------------------------- /debian/openvswitch-controller.manpages: -------------------------------------------------------------------------------- 1 | _debian/utilities/ovs-controller.8 2 | -------------------------------------------------------------------------------- /debian/ovsdbmonitor.install: -------------------------------------------------------------------------------- 1 | usr/bin/ovsdbmonitor 2 | usr/share/ovsdbmonitor 3 | -------------------------------------------------------------------------------- /lib/ssl-bootstrap-syn.man: -------------------------------------------------------------------------------- 1 | .br 2 | [\fB\-\-bootstrap\-ca\-cert=\fIcacert.pem] 3 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-source.dirs: -------------------------------------------------------------------------------- 1 | usr/src/modules/openvswitch-datapath/debian 2 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.dirs: -------------------------------------------------------------------------------- 1 | /etc/openvswitch 2 | /usr/share/openvswitch/switch 3 | -------------------------------------------------------------------------------- /debian/openvswitch-ipsec.install: -------------------------------------------------------------------------------- 1 | debian/ovs-monitor-ipsec usr/share/openvswitch/scripts 2 | -------------------------------------------------------------------------------- /debian/python-openvswitch.dirs: -------------------------------------------------------------------------------- 1 | usr/share/pyshared/ovs/ 2 | usr/share/pyshared/ovs/db/ 3 | -------------------------------------------------------------------------------- /lib/unixctl-syn.man: -------------------------------------------------------------------------------- 1 | .IP "Runtime management options:" 2 | \fB\-\-unixctl=\fIsocket\fR 3 | -------------------------------------------------------------------------------- /debian/openvswitch-test.manpages: -------------------------------------------------------------------------------- 1 | _debian/utilities/ovs-test.8 2 | _debian/utilities/ovs-l3ping.8 3 | -------------------------------------------------------------------------------- /debian/python-openvswitch.install: -------------------------------------------------------------------------------- 1 | usr/share/openvswitch/python/ovs usr/lib/python2.6/dist-packages/ 2 | -------------------------------------------------------------------------------- /python/compat/automake.mk: -------------------------------------------------------------------------------- 1 | EXTRA_DIST += \ 2 | python/compat/uuid.py \ 3 | python/compat/argparse.py 4 | -------------------------------------------------------------------------------- /third-party/automake.mk: -------------------------------------------------------------------------------- 1 | EXTRA_DIST += \ 2 | third-party/README \ 3 | third-party/ofp-tcpdump.patch 4 | -------------------------------------------------------------------------------- /include/linux/automake.mk: -------------------------------------------------------------------------------- 1 | noinst_HEADERS += \ 2 | include/linux/openvswitch.h \ 3 | include/linux/types.h 4 | -------------------------------------------------------------------------------- /datapath/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | *.cmd 4 | *.ko 5 | *.mod.c 6 | Module.symvers 7 | /distfiles 8 | -------------------------------------------------------------------------------- /lib/common-syn.man: -------------------------------------------------------------------------------- 1 | .IP "Common options:" 2 | [\fB\-h\fR | \fB\-\-help\fR] 3 | [\fB\-V\fR | \fB\-\-version\fR] 4 | 5 | -------------------------------------------------------------------------------- /vswitchd/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | /ovs-vswitchd 4 | /ovs-vswitchd.8 5 | /ovs-vswitchd.conf.db.5 6 | /vswitch.ovsschema.stamp 7 | -------------------------------------------------------------------------------- /debian/openvswitch-test.install: -------------------------------------------------------------------------------- 1 | usr/share/openvswitch/python/ovstest usr/lib/python2.6/dist-packages/ 2 | usr/bin/ovs-test 3 | usr/bin/ovs-l3ping 4 | -------------------------------------------------------------------------------- /rhel/.gitignore: -------------------------------------------------------------------------------- 1 | openvswitch-kmod-rhel5.spec 2 | openvswitch-kmod-rhel6.spec 3 | openvswitch-kmod-fedora.spec 4 | openvswitch.spec 5 | openvswitch-fedora.spec 6 | -------------------------------------------------------------------------------- /lib/daemon-syn.man: -------------------------------------------------------------------------------- 1 | .IP "Daemon options:" 2 | [\fB\-\-pidfile\fR[\fB=\fIpidfile\fR]] 3 | [\fB\-\-overwrite\-pidfile\fR] 4 | [\fB\-\-detach\fR] 5 | [\fB\-\-no\-chdir\fR] 6 | -------------------------------------------------------------------------------- /include/openvswitch/automake.mk: -------------------------------------------------------------------------------- 1 | noinst_HEADERS += \ 2 | include/openvswitch/datapath-compat.h \ 3 | include/openvswitch/tunnel.h \ 4 | include/openvswitch/types.h 5 | 6 | -------------------------------------------------------------------------------- /include/automake.mk: -------------------------------------------------------------------------------- 1 | include include/linux/automake.mk 2 | include include/openflow/automake.mk 3 | include include/openvswitch/automake.mk 4 | include include/sparse/automake.mk 5 | -------------------------------------------------------------------------------- /ovsdb/.gitignore: -------------------------------------------------------------------------------- 1 | /ovsdb-client 2 | /ovsdb-client.1 3 | /ovsdb-doc 4 | /ovsdb-dot 5 | /ovsdb-idlc 6 | /ovsdb-server 7 | /ovsdb-server.1 8 | /ovsdb-tool 9 | /ovsdb-tool.1 10 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.links: -------------------------------------------------------------------------------- 1 | usr/share/openvswitch/scripts/ifupdown.sh etc/network/if-pre-up.d/openvswitch 2 | usr/share/openvswitch/scripts/ifupdown.sh etc/network/if-post-down.d/openvswitch 3 | -------------------------------------------------------------------------------- /lib/ssl-syn.man: -------------------------------------------------------------------------------- 1 | .IP "Public key infrastructure options:" 2 | [\fB\-\-private\-key=\fIprivkey.pem\fR] 3 | .br 4 | [\fB\-\-certificate=\fIcert.pem\fR] 5 | .br 6 | [\fB\-\-ca\-cert=\fIcacert.pem\fR] 7 | -------------------------------------------------------------------------------- /lib/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | /dhparams.c 4 | /dirs.c 5 | /coverage-counters.c 6 | /ofp-errors.inc 7 | /ofp-msgs.inc 8 | /vswitch-idl.c 9 | /vswitch-idl.h 10 | /vswitch-idl.ovsidl 11 | -------------------------------------------------------------------------------- /tests/openssl.supp: -------------------------------------------------------------------------------- 1 | # suppress OpenSSL errors from valgrind 2 | 3 | { 4 | BN_mod_inverse 5 | Memcheck:Cond 6 | fun:BN_mod_inverse 7 | } 8 | 9 | { 10 | BN_div 11 | Memcheck:Cond 12 | fun:BN_div 13 | } 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/reciprocal_div.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | u32 reciprocal_value(u32 k) 5 | { 6 | u64 val = (1LL << 32) + (k - 1); 7 | do_div(val, k); 8 | return (u32)val; 9 | } 10 | -------------------------------------------------------------------------------- /lib/vlog-syn.man: -------------------------------------------------------------------------------- 1 | .IP "Logging options:" 2 | [\fB\-v\fR[\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]]]\&... 3 | .br 4 | [\fB\-\-verbose[=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]]]\&... 5 | .br 6 | [\fB\-\-log\-file\fR[\fB=\fIfile\fR]] 7 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/ovsdbmonitor.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Open vSwitch DB Monitor 3 | Comment=Monitor and troubleshoot local or remote Open vSwitch instances 4 | Exec=ovsdbmonitor 5 | Terminal=false 6 | Type=Application 7 | Categories=System;Monitor; 8 | -------------------------------------------------------------------------------- /datapath/linux/Makefile.in: -------------------------------------------------------------------------------- 1 | ifeq ($(KERNELRELEASE),) 2 | # We're being called directly by running make in this directory. 3 | include Makefile.main 4 | else 5 | # We're being included by the Linux kernel build system 6 | include Kbuild 7 | endif 8 | 9 | 10 | -------------------------------------------------------------------------------- /lib/common.man: -------------------------------------------------------------------------------- 1 | .de IQ 2 | . br 3 | . ns 4 | . IP "\\$1" 5 | .. 6 | .IP "\fB\-h\fR" 7 | .IQ "\fB\-\-help\fR" 8 | Prints a brief help message to the console. 9 | . 10 | .IP "\fB\-V\fR" 11 | .IQ "\fB\-\-version\fR" 12 | Prints version information to the console. 13 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/asm/percpu.h: -------------------------------------------------------------------------------- 1 | #ifndef __ASM_PERCPU_WRAPPER_H 2 | #define __ASM_PERCPU_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef this_cpu_ptr 7 | #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id()) 8 | #endif 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /lib/memory-unixctl.man: -------------------------------------------------------------------------------- 1 | .SS "MEMORY COMMANDS" 2 | These commands report memory usage. 3 | . 4 | .IP "\fBmemory/show\fR" 5 | Displays some basic statistics about \fB\*(PN\fR's memory usage. 6 | \fB\*(PN\fR also logs this information soon after startup and 7 | periodically as its memory consumption grows. 8 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/compiler.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_COMPILER_WRAPPER_H 2 | #define __LINUX_COMPILER_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef __percpu 7 | #define __percpu 8 | #endif 9 | 10 | #ifndef __rcu 11 | #define __rcu 12 | #endif 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /tests/glibc.supp: -------------------------------------------------------------------------------- 1 | # suppress what appear to unavoidable error reports from glibc 2 | 3 | { 4 | timer_create 5 | Memcheck:Leak 6 | fun:malloc 7 | fun:timer_create 8 | } 9 | 10 | { 11 | timer_create 12 | Memcheck:Param 13 | timer_create(evp) 14 | fun:timer_create 15 | } 16 | 17 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.manpages: -------------------------------------------------------------------------------- 1 | _debian/ovsdb/ovsdb-server.1 2 | _debian/utilities/ovs-dpctl.8 3 | _debian/utilities/ovs-pcap.1 4 | _debian/utilities/ovs-tcpundump.1 5 | _debian/utilities/ovs-vlan-test.8 6 | _debian/utilities/ovs-vsctl.8 7 | _debian/vswitchd/ovs-vswitchd.8 8 | vswitchd/ovs-vswitchd.conf.db.5 9 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/compiler-gcc.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_COMPILER_H 2 | #error "Please don't include directly, include instead." 3 | #endif 4 | 5 | #include_next 6 | 7 | #ifndef __packed 8 | #define __packed __attribute__((packed)) 9 | #endif 10 | -------------------------------------------------------------------------------- /debian/dkms.conf.in: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME="openvswitch" 2 | PACKAGE_VERSION="__VERSION__" 3 | MAKE="./configure --with-linux='${kernel_source_dir}' && make -C datapath/linux" 4 | BUILT_MODULE_NAME[0]=openvswitch 5 | BUILT_MODULE_LOCATION[0]=datapath/linux/ 6 | DEST_MODULE_LOCATION[0]=/kernel/drivers/net/openvswitch/ 7 | AUTOINSTALL=yes 8 | -------------------------------------------------------------------------------- /include/sparse/automake.mk: -------------------------------------------------------------------------------- 1 | noinst_HEADERS += \ 2 | include/sparse/arpa/inet.h \ 3 | include/sparse/assert.h \ 4 | include/sparse/math.h \ 5 | include/sparse/netinet/in.h \ 6 | include/sparse/netinet/ip6.h \ 7 | include/sparse/sys/socket.h \ 8 | include/sparse/sys/wait.h 9 | -------------------------------------------------------------------------------- /debian/openvswitch-common.install: -------------------------------------------------------------------------------- 1 | usr/bin/ovs-appctl 2 | usr/bin/ovs-benchmark 3 | usr/bin/ovs-ofctl 4 | usr/bin/ovs-parse-backtrace 5 | usr/bin/ovs-parse-leaks 6 | usr/bin/ovs-pki 7 | usr/bin/ovsdb-client 8 | usr/sbin/ovs-bugtool 9 | usr/share/openvswitch/bugtool-plugins 10 | usr/share/openvswitch/scripts/ovs-bugtool-* 11 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/poison.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_POISON_WRAPPER_H 2 | #define __LINUX_POISON_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef FLEX_ARRAY_FREE 7 | /********** lib/flex_array.c **********/ 8 | #define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */ 9 | #endif 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /debian/openvswitch-controller.README.Debian: -------------------------------------------------------------------------------- 1 | README.Debian for openvswitch-controller 2 | ------------------------------------- 3 | 4 | * To (re)configure the controller, edit /etc/default/openvswitch-controller 5 | and run "/etc/init.d/openvswitch-controller restart". 6 | 7 | -- Ben Pfaff , Fri, 4 Mar 2011 14:28:53 -0800 8 | -------------------------------------------------------------------------------- /debian/openvswitch-common.manpages: -------------------------------------------------------------------------------- 1 | _debian/ovsdb/ovsdb-client.1 2 | _debian/ovsdb/ovsdb-tool.1 3 | _debian/utilities/ovs-appctl.8 4 | _debian/utilities/ovs-benchmark.1 5 | _debian/utilities/ovs-ofctl.8 6 | _debian/utilities/ovs-pki.8 7 | _debian/utilities/bugtool/ovs-bugtool.8 8 | utilities/ovs-parse-backtrace.8 9 | utilities/ovs-parse-leaks.8 10 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.template: -------------------------------------------------------------------------------- 1 | # This is a POSIX shell fragment -*- sh -*- 2 | 3 | # FORCE_COREFILES: If 'yes' then core files will be enabled. 4 | # FORCE_COREFILES=yes 5 | 6 | # OVS_CTL_OPTS: Extra options to pass to ovs-ctl. This is, for example, 7 | # a suitable place to specify --ovs-vswitchd-wrapper=valgrind. 8 | # OVS_CTL_OPTS= 9 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-dkms.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | package=openvswitch-datapath-dkms 6 | name=openvswitch 7 | 8 | version=`dpkg-query -W -f='${Version}' "$package" \ 9 | |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"` 10 | 11 | dkms remove -m "$name" -v "$version" --all || true 12 | 13 | #DEBHELPER# 14 | 15 | exit 0 16 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-source.install: -------------------------------------------------------------------------------- 1 | debian/changelog usr/src/modules/openvswitch-datapath/debian 2 | debian/control usr/src/modules/openvswitch-datapath/debian 3 | debian/compat usr/src/modules/openvswitch-datapath/debian 4 | debian/*.modules.in usr/src/modules/openvswitch-datapath/debian 5 | _debian/openvswitch.tar.gz usr/src/modules/openvswitch-datapath 6 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_STDDEF_WRAPPER_H 2 | #define __LINUX_STDDEF_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifdef __KERNEL__ 7 | 8 | #ifndef HAVE_BOOL_TYPE 9 | enum { 10 | false = 0, 11 | true = 1 12 | }; 13 | #endif /* !HAVE_BOOL_TYPE */ 14 | 15 | #endif /* __KERNEL__ */ 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/icmp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_ICMP_WRAPPER_H 2 | #define __LINUX_ICMP_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_SKBUFF_HEADER_HELPERS 7 | static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb) 8 | { 9 | return (struct icmphdr *)skb_transport_header(skb); 10 | } 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/icmpv6.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_ICMPV6_WRAPPER_H 2 | #define __LINUX_ICMPV6_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_ICMP6_HDR 7 | static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb) 8 | { 9 | return (struct icmp6hdr *)skb_transport_header(skb); 10 | } 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/ipv6.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IPV6_WRAPPER_H 2 | #define __LINUX_IPV6_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_SKBUFF_HEADER_HELPERS 7 | static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) 8 | { 9 | return (struct ipv6hdr *)skb_network_header(skb); 10 | } 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/sock.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_SOCK_WRAPPER_H 2 | #define __NET_SOCK_WRAPPER_H 1 3 | 4 | #include_next 5 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) 6 | struct net; 7 | 8 | static inline struct net *sock_net(const struct sock *sk) 9 | { 10 | return NULL; 11 | } 12 | 13 | #endif 14 | 15 | #endif /* net/sock.h wrapper */ 16 | -------------------------------------------------------------------------------- /rhel/usr_lib_systemd_system_openvswitch.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Open vSwitch 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=/usr/share/openvswitch/scripts/openvswitch.init start 8 | ExecStop=/usr/share/openvswitch/scripts/openvswitch.init stop 9 | RemainAfterExit=yes 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/cpumask.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_CPUMASK_WRAPPER_H 2 | #define __LINUX_CPUMASK_WRAPPER_H 3 | 4 | #include_next 5 | 6 | /* for_each_cpu was renamed for_each_possible_cpu in 2.6.18. */ 7 | #ifndef for_each_possible_cpu 8 | #define for_each_possible_cpu for_each_cpu 9 | #endif 10 | 11 | #endif /* linux/cpumask.h wrapper */ 12 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/types.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TYPES_WRAPPER_H 2 | #define __LINUX_TYPES_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_CSUM_TYPES 7 | typedef __u16 __bitwise __sum16; 8 | typedef __u32 __bitwise __wsum; 9 | #endif 10 | 11 | #ifndef HAVE_BOOL_TYPE 12 | typedef _Bool bool; 13 | #endif /* !HAVE_BOOL_TYPE */ 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/bug.h: -------------------------------------------------------------------------------- 1 | #ifndef __BUG_H_WRAPPER 2 | #define __BUG_H_WRAPPER 1 3 | 4 | #include_next 5 | 6 | #ifndef BUILD_BUG_ON_NOT_POWER_OF_2 7 | /* Force a compilation error if a constant expression is not a power of 2 */ 8 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ 9 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/ip.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_IP_WRAPPER_H 2 | #define __NET_IP_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 8 | 9 | extern int __ip_local_out(struct sk_buff *skb); 10 | extern int ip_local_out(struct sk_buff *skb); 11 | 12 | #endif /* linux kernel < 2.6.25 */ 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /lib/vswitch-idl.ann: -------------------------------------------------------------------------------- 1 | # -*- python -*- 2 | 3 | # This code, when invoked by "ovsdb-idlc annotate" (by the build 4 | # process), annotates vswitch.ovsschema with additional data that give 5 | # the ovsdb-idl engine information about the types involved, so that 6 | # it can generate more programmer-friendly data structures. 7 | 8 | s["idlPrefix"] = "ovsrec_" 9 | s["idlHeader"] = "\"lib/vswitch-idl.h\"" 10 | -------------------------------------------------------------------------------- /tests/idltest.ann: -------------------------------------------------------------------------------- 1 | # -*- python -*- 2 | 3 | # This code, when invoked by "ovsdb-idlc annotate" (by the build 4 | # process), annotates idltest.ovsschema with additional data that give 5 | # the ovsdb-idl engine information about the types involved, so that 6 | # it can generate more programmer-friendly data structures. 7 | 8 | s["idlPrefix"] = "idltest_" 9 | s["idlHeader"] = "\"tests/idltest.h\"" 10 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/inetdevice.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_INETDEVICE_WRAPPER_H 2 | #define __LINUX_INETDEVICE_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 8 | 9 | #define inetdev_by_index(net, ifindex) \ 10 | inetdev_by_index((ifindex)) 11 | 12 | #endif /* linux kernel < 2.6.25 */ 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /datapath/linux/compat/skbuff-openvswitch.c: -------------------------------------------------------------------------------- 1 | #if !defined(HAVE_SKB_WARN_LRO) && defined(NETIF_F_LRO) 2 | 3 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 4 | 5 | #include 6 | 7 | void __skb_warn_lro_forwarding(const struct sk_buff *skb) 8 | { 9 | if (net_ratelimit()) 10 | pr_warn("%s: received packets cannot be forwarded while LRO is enabled\n", 11 | skb->dev->name); 12 | } 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/openvswitch/*.log { 2 | daily 3 | compress 4 | create 640 root adm 5 | delaycompress 6 | missingok 7 | rotate 30 8 | postrotate 9 | # Tell Open vSwitch daemons to reopen their log files 10 | for pidfile in `cd /var/run/openvswitch && echo *.pid`; do 11 | ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 12 | done 13 | endscript 14 | } 15 | -------------------------------------------------------------------------------- /tests/heap.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([heap library]) 2 | 3 | m4_define([TEST_HEAP], 4 | [AT_SETUP([heap library -- m4_bpatsubst([$1], [-], [ ])]) 5 | AT_CHECK([test-heap $1]) 6 | AT_CLEANUP]) 7 | 8 | TEST_HEAP([insert-delete-same-order]) 9 | TEST_HEAP([insert-delete-reverse-order]) 10 | TEST_HEAP([insert-delete-every-order]) 11 | TEST_HEAP([insert-delete-same-order-with-dups]) 12 | TEST_HEAP([raw-insert]) 13 | TEST_HEAP([raw-delete]) 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/if_arp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IF_ARP_WRAPPER_H 2 | #define __LINUX_IF_ARP_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_SKBUFF_HEADER_HELPERS 7 | #include 8 | 9 | static inline struct arphdr *arp_hdr(const struct sk_buff *skb) 10 | { 11 | return (struct arphdr *)skb_network_header(skb); 12 | } 13 | #endif /* !HAVE_SKBUFF_HEADER_HELPERS */ 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-source.copyright: -------------------------------------------------------------------------------- 1 | Upstream Authors: 2 | 3 | Nicira, Inc. 4 | 5 | Copyright: 6 | 7 | Copyright (C) 2008 Nicira, Inc. 8 | 9 | License: 10 | 11 | Files in the datapath/ and its sub-directories are covered under the GNU 12 | General Public License Version 2. 13 | 14 | On Debian systems, the complete text of the GNU General 15 | Public License can be found in `/usr/share/common-licenses/GPL'. 16 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/protocol.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_PROTOCOL_WRAPPER_H 2 | #define __NET_PROTOCOL_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) 8 | #define inet_add_protocol(prot, num) inet_add_protocol((struct net_protocol *)(prot), num) 9 | #define inet_del_protocol(prot, num) inet_del_protocol((struct net_protocol *)(prot), num) 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/log2.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_LOG2_WRAPPER 2 | #define __LINUX_LOG2_WRAPPER 3 | 4 | #ifdef HAVE_LOG2_H 5 | #include_next 6 | #else 7 | /* This is very stripped down because log2.h has far too many dependencies. */ 8 | 9 | extern __attribute__((const, noreturn)) 10 | int ____ilog2_NaN(void); 11 | 12 | #define ilog2(n) ((n) == 4 ? 2 : \ 13 | (n) == 8 ? 3 : \ 14 | ____ilog2_NaN()) 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/netns/generic.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_NET_NETNS_GENERIC_WRAPPER_H 2 | #define __NET_NET_NETNS_GENERIC_WRAPPER_H 1 3 | 4 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) 5 | /* exists, go ahead and include it. */ 6 | #include_next 7 | #else 8 | #define net_generic rpl_net_generic 9 | void *net_generic(const struct net *net, int id); 10 | #endif 11 | 12 | #endif /* net/netns/generic.h wrapper */ 13 | -------------------------------------------------------------------------------- /tests/ovsdb-macros.at: -------------------------------------------------------------------------------- 1 | dnl OVSDB_INIT([$1]) 2 | dnl 3 | dnl Creates an empty database named $1. 4 | m4_define([OVSDB_INIT], 5 | [AT_CHECK( 6 | [ovsdb-tool create $1 $abs_top_srcdir/vswitchd/vswitch.ovsschema], 7 | [0], [stdout], [ignore]) 8 | AT_CHECK( 9 | [[ovsdb-tool transact $1 \ 10 | '["Open_vSwitch", 11 | {"op": "insert", 12 | "table": "Open_vSwitch", 13 | "row": {}}]']], 14 | [0], [ignore], [ignore])]) 15 | -------------------------------------------------------------------------------- /datapath/linux/compat/kmemdup.c: -------------------------------------------------------------------------------- 1 | #ifndef HAVE_KMEMDUP 2 | 3 | #include 4 | #include 5 | 6 | /** 7 | * kmemdup - duplicate region of memory 8 | * 9 | * @src: memory region to duplicate 10 | * @len: memory region length 11 | * @gfp: GFP mask to use 12 | */ 13 | void *kmemdup(const void *src, size_t len, gfp_t gfp) 14 | { 15 | void *p; 16 | 17 | p = kmalloc(len, gfp); 18 | if (p) 19 | memcpy(p, src, len); 20 | return p; 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /README-gcov: -------------------------------------------------------------------------------- 1 | Building with gcov support 2 | ========================== 3 | 4 | The Open vSwitch "configure" script supports the following 5 | code-coverage related options: 6 | 7 | --disable-coverage 8 | --enable-coverage=no 9 | 10 | Do not build with gcov code coverage support. 11 | 12 | This is the default if no coverage option is passed to 13 | "configure". 14 | 15 | --enable-coverage 16 | --enable-coverage=yes 17 | 18 | Build with gcov code coverage support. 19 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | *.debhelper 2 | *.debhelper.log 3 | *.substvars 4 | /control 5 | /copyright 6 | /files 7 | /nicira-switch 8 | /openvswitch 9 | /openvswitch-common 10 | /openvswitch-common.copyright 11 | /openvswitch-controller 12 | /openvswitch-datapath-source 13 | /openvswitch-datapath-dkms 14 | /openvswitch-dbg 15 | /openvswitch-ipsec 16 | /openvswitch-pki 17 | /openvswitch-switch 18 | /openvswitch-switch.copyright 19 | /openvswitch-test 20 | /ovsdbmonitor 21 | /python-openvswitch 22 | /tmp 23 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/inet_frag.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_INET_FRAG_WRAPPER_H 2 | #define __NET_INET_FRAG_WRAPPER_H 1 3 | 4 | #include 5 | #include_next 6 | 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) 8 | #define inet_frag_evictor(nf, f, force) \ 9 | do { \ 10 | if (force || atomic_read(&nf->mem) > nf->high_thresh) { \ 11 | inet_frag_evictor(nf, f); \ 12 | } \ 13 | } while (0) 14 | #endif 15 | 16 | #endif /* inet_frag.h */ 17 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.install: -------------------------------------------------------------------------------- 1 | usr/bin/ovs-dpctl 2 | usr/bin/ovs-pcap 3 | usr/bin/ovs-tcpundump 4 | usr/bin/ovs-vlan-test 5 | usr/bin/ovs-vsctl 6 | usr/bin/ovsdb-tool 7 | usr/sbin/ovs-vswitchd 8 | usr/sbin/ovsdb-server 9 | usr/share/openvswitch/scripts/ovs-check-dead-ifs 10 | usr/share/openvswitch/scripts/ovs-ctl 11 | usr/share/openvswitch/scripts/ovs-lib 12 | usr/share/openvswitch/scripts/ovs-save 13 | usr/share/openvswitch/vswitch.ovsschema 14 | debian/ifupdown.sh usr/share/openvswitch/scripts 15 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/udp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_UDP_WRAPPER_H 2 | #define __LINUX_UDP_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_SKBUFF_HEADER_HELPERS 7 | static inline struct udphdr *udp_hdr(const struct sk_buff *skb) 8 | { 9 | return (struct udphdr *)skb_transport_header(skb); 10 | } 11 | #endif /* HAVE_SKBUFF_HEADER_HELPERS */ 12 | 13 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) 14 | static inline void udp_encap_enable(void) 15 | { 16 | } 17 | #endif 18 | #endif 19 | -------------------------------------------------------------------------------- /ovsdb/remote-active.man: -------------------------------------------------------------------------------- 1 | .IP "\fBssl:\fIip\fB:\fIport\fR" 2 | The specified SSL \fIport\fR on the host at the given \fIip\fR, which 3 | must be expressed as an IP address (not a DNS name). The 4 | \fB\-\-private\-key\fR, \fB\-\-certificate\fR, and \fB\-\-ca\-cert\fR 5 | options are mandatory when this form is used. 6 | . 7 | .IP "\fBtcp:\fIip\fB:\fIport\fR" 8 | Connect to the given TCP \fIport\fR on \fIip\fR. 9 | . 10 | .IP "\fBunix:\fIfile\fR" 11 | Connect to the Unix domain server socket named \fIfile\fR. 12 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_TCP_WRAPPER_H 2 | #define __LINUX_TCP_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_SKBUFF_HEADER_HELPERS 7 | static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) 8 | { 9 | return (struct tcphdr *)skb_transport_header(skb); 10 | } 11 | 12 | static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) 13 | { 14 | return tcp_hdr(skb)->doff * 4; 15 | } 16 | #endif /* !HAVE_SKBUFF_HEADER_HELPERS */ 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /tests/ovsdb-column.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([OVSDB -- columns]) 2 | 3 | OVSDB_CHECK_POSITIVE_CPY([ordinary column], 4 | [[parse-column mycol '{"type": "integer"}']], 5 | [[{"type":"integer"}]]) 6 | 7 | OVSDB_CHECK_POSITIVE_CPY([immutable column], 8 | [[parse-column mycol '{"type": "real", "mutable": false}']], 9 | [[{"mutable":false,"type":"real"}]]) 10 | 11 | OVSDB_CHECK_POSITIVE_CPY([ephemeral column], 12 | [[parse-column mycol '{"type": "uuid", "ephemeral": true}']], 13 | [[{"ephemeral":true,"type":"uuid"}]]) 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/ip.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IP_WRAPPER_H 2 | #define __LINUX_IP_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_SKBUFF_HEADER_HELPERS 7 | #include 8 | static inline struct iphdr *ip_hdr(const struct sk_buff *skb) 9 | { 10 | return (struct iphdr *)skb_network_header(skb); 11 | } 12 | 13 | static inline unsigned int ip_hdrlen(const struct sk_buff *skb) 14 | { 15 | return ip_hdr(skb)->ihl * 4; 16 | } 17 | #endif /* !HAVE_SKBUFF_HEADER_HELPERS */ 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /lib/dh1024.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIGHAoGBAPSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsY 3 | jY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6 4 | ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpL3jHAgEC 5 | -----END DH PARAMETERS----- 6 | 7 | These are the 1024 bit DH parameters from "Assigned Number for SKIP Protocols" 8 | (http://www.skip-vpn.org/spec/numbers.html). 9 | See there for how they were generated. 10 | Note that g is not a generator, but this is not a problem since p is a safe prime. 11 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/rcupdate.h: -------------------------------------------------------------------------------- 1 | #ifndef __RCUPDATE_WRAPPER_H 2 | #define __RCUPDATE_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef rcu_dereference_check 7 | #define rcu_dereference_check(p, c) rcu_dereference(p) 8 | #endif 9 | 10 | #ifndef rcu_dereference_protected 11 | #define rcu_dereference_protected(p, c) (p) 12 | #endif 13 | 14 | #ifndef HAVE_RCU_READ_LOCK_HELD 15 | static inline int rcu_read_lock_held(void) 16 | { 17 | return 1; 18 | } 19 | #endif 20 | 21 | #endif /* linux/rcupdate.h wrapper */ 22 | -------------------------------------------------------------------------------- /lib/unixctl.man: -------------------------------------------------------------------------------- 1 | .IP "\fB\-\-unixctl=\fIsocket\fR" 2 | Sets the name of the control socket on which \fB\*(PN\fR listens for 3 | runtime management commands (see \fBRUNTIME MANAGEMENT COMMANDS\fR, 4 | below). If \fIsocket\fR does not begin with \fB/\fR, it is 5 | interpreted as relative to \fB@RUNDIR@\fR. If \fB\-\-unixctl\fR is 6 | not used at all, the default socket is 7 | \fB@RUNDIR@/\*(PN.\fIpid\fB.ctl\fR, where \fIpid\fR is \fB\*(PN\fR's 8 | process ID. 9 | Specifying \fBnone\fR for \fIsocket\fR disables the control socket 10 | feature. 11 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/netfilter_ipv4.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_NETFILTER_IPV4_WRAPPER_H 2 | #define __LINUX_NETFILTER_IPV4_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 8 | 9 | #ifdef __KERNEL__ 10 | 11 | #define NF_INET_PRE_ROUTING NF_IP_PRE_ROUTING 12 | #define NF_INET_POST_ROUTING NF_IP_POST_ROUTING 13 | #define NF_INET_FORWARD NF_IP_FORWARD 14 | 15 | #endif /* __KERNEL__ */ 16 | 17 | #endif /* linux kernel < 2.6.25 */ 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /python/ovs/dirs.py: -------------------------------------------------------------------------------- 1 | import os 2 | PKGDATADIR = os.environ.get("OVS_PKGDATADIR", """/usr/local/share/openvswitch""") 3 | RUNDIR = os.environ.get("OVS_RUNDIR", """/var/run""") 4 | LOGDIR = os.environ.get("OVS_LOGDIR", """/usr/local/var/log""") 5 | BINDIR = os.environ.get("OVS_BINDIR", """/usr/local/bin""") 6 | 7 | DBDIR = os.environ.get("OVS_DBDIR") 8 | if not DBDIR: 9 | sysconfdir = os.environ.get("OVS_SYSCONFDIR") 10 | if sysconfdir: 11 | DBDIR = "%s/openvswitch" % sysconfdir 12 | else: 13 | DBDIR = """/usr/local/etc/openvswitch""" 14 | -------------------------------------------------------------------------------- /lib/coverage-unixctl.man: -------------------------------------------------------------------------------- 1 | .SS "COVERAGE COMMANDS" 2 | These commands manage \fB\*(PN\fR's ``coverage counters,'' which count 3 | the number of times particular events occur during a daemon's runtime. 4 | In addition to these commands, \fB\*(PN\fR automatically logs coverage 5 | counter values, at \fBINFO\fR level, when it detects that the daemon's 6 | main loop takes unusually long to run. 7 | .PP 8 | Coverage counters are useful mainly for performance analysis and 9 | debugging. 10 | .IP "\fBcoverage/show\fR" 11 | Displays the values of all of the coverage counters. 12 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/if.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IF_WRAPPER_H 2 | #define __LINUX_IF_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) 8 | 9 | #define IFF_XMIT_DST_RELEASE 0 10 | 11 | #endif /* linux kernel < 2.6.31 */ 12 | 13 | #ifndef IFF_TX_SKB_SHARING 14 | #define IFF_TX_SKB_SHARING 0 15 | #endif 16 | 17 | #ifndef IFF_OVS_DATAPATH 18 | #define IFF_OVS_DATAPATH 0 19 | #endif 20 | 21 | #ifndef IFF_LIVE_ADDR_CHANGE 22 | #define IFF_LIVE_ADDR_CHANGE 0 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-dkms.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | package=openvswitch-datapath-dkms 6 | name=openvswitch 7 | 8 | version=`dpkg-query -W -f='${Version}' "$package" \ 9 | |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"` 10 | 11 | isadded=`dkms status -m "$name" -v "$version"` 12 | 13 | if [ "x${isadded}" = "x" ] ; then 14 | dkms add -m "$name" -v "$version" 15 | fi 16 | 17 | if [ "$1" = 'configure' ] ; then 18 | dkms build -m "$name" -v "$version" && dkms install -m "$name" -v "$version" || true 19 | fi 20 | 21 | #DEBHELPER# 22 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/if_ether.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IF_ETHER_WRAPPER_H 2 | #define __LINUX_IF_ETHER_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) 8 | 9 | #define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ 10 | 11 | #endif /* linux kernel < 2.6.28 */ 12 | 13 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) 14 | 15 | #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 16 | 17 | #endif /* linux kernel < 2.6.30 */ 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/route.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_ROUTE_WRAPPER_H 2 | #define __NET_ROUTE_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 8 | 9 | #define ip_route_output_key(net, rp, flp) \ 10 | ip_route_output_key((rp), (flp)) 11 | 12 | #endif /* linux kernel < 2.6.25 */ 13 | 14 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) 15 | static inline int ip4_dst_hoplimit(const struct dst_entry *dst) 16 | { 17 | return dst_metric(dst, RTAX_HOPLIMIT); 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/dst.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_DST_WRAPPER_H 2 | #define __NET_DST_WRAPPER_H 1 3 | 4 | #include 5 | #include_next 6 | 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) && \ 8 | LINUX_VERSION_CODE > KERNEL_VERSION(3,0,20) 9 | 10 | #define dst_get_neighbour_noref dst_get_neighbour 11 | 12 | #endif 13 | 14 | #ifndef HAVE_SKB_DST_ACCESSOR_FUNCS 15 | 16 | static inline void skb_dst_drop(struct sk_buff *skb) 17 | { 18 | if (skb->dst) 19 | dst_release(skb_dst(skb)); 20 | skb->dst = NULL; 21 | } 22 | 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/genetlink.h: -------------------------------------------------------------------------------- 1 | #ifndef __GENETLINK_WRAPPER_H 2 | #define __GENETLINK_WRAPPER_H 1 3 | 4 | #include 5 | #include_next 6 | 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) 8 | #ifdef CONFIG_PROVE_LOCKING 9 | static inline int lockdep_genl_is_held(void) 10 | { 11 | return 1; 12 | } 13 | #endif 14 | #endif 15 | 16 | #ifndef genl_dereference 17 | #include 18 | 19 | #define genl_dereference(p) \ 20 | rcu_dereference_protected(p, lockdep_genl_is_held()) 21 | #endif 22 | 23 | #endif /* linux/genetlink.h wrapper */ 24 | -------------------------------------------------------------------------------- /lib/vconn-active.man: -------------------------------------------------------------------------------- 1 | .IP "\fBssl:\fIip\fR[\fB:\fIport\fR]" 2 | The specified SSL \fIport\fR (default: 6633) on the host at the given 3 | \fIip\fR, which must be expressed as an IP address (not a DNS name). 4 | The \fB\-\-private\-key\fR, \fB\-\-certificate\fR, and 5 | \fB\-\-ca\-cert\fR options are mandatory when this form is used. 6 | . 7 | .IP "\fBtcp:\fIip\fR[\fB:\fIport\fR]" 8 | The specified TCP \fIport\fR (default: 6633) on the host at the given 9 | \fIip\fR, which must be expressed as an IP address (not a DNS name). 10 | . 11 | .TP 12 | \fBunix:\fIfile\fR 13 | The Unix domain server socket named \fIfile\fR. 14 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/err.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_ERR_WRAPPER_H 2 | #define __LINUX_ERR_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_ERR_CAST 7 | /** 8 | * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type 9 | * @ptr: The pointer to cast. 10 | * 11 | * Explicitly cast an error-valued pointer to another pointer type in such a 12 | * way as to make it clear that's what's going on. 13 | */ 14 | static inline void *ERR_CAST(const void *ptr) 15 | { 16 | /* cast away the const */ 17 | return (void *) ptr; 18 | } 19 | #endif /* HAVE_ERR_CAST */ 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Citrix Systems, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at: 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /lib/dh2048.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIIBCAKCAQEA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV 3 | 89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50 4 | T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknb 5 | zSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdX 6 | Q6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbT 7 | CD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwIBAg== 8 | -----END DH PARAMETERS----- 9 | 10 | These are the 2048 bit DH parameters from "Assigned Number for SKIP Protocols" 11 | (http://www.skip-vpn.org/spec/numbers.html). 12 | See there for how they were generated. 13 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/netfilter_bridge.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_NETFILTER_BRIDGE_WRAPPER_H 2 | #define __LINUX_NETFILTER_BRIDGE_WRAPPER_H 3 | 4 | #include_next 5 | 6 | #include 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) 8 | 9 | #include 10 | #include 11 | 12 | static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 13 | { 14 | switch (skb->protocol) { 15 | case __constant_htons(ETH_P_8021Q): 16 | return VLAN_HLEN; 17 | default: 18 | return 0; 19 | } 20 | } 21 | 22 | #endif /* linux version < 2.6.22 */ 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-module-_KVERS_.postinst.modules.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postinst script for #PACKAGE# 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | #DEBHELPER# 9 | 10 | # If the switch is running, restart it. This ensures that we are using the 11 | # latest kernel module, because the init script will unload and reload the 12 | # module. 13 | # 14 | # (Ideally we'd only want to do this if this package corresponds to the 15 | # running kernel, but I don't know a reliable way to check.) 16 | INIT=/etc/init.d/openvswitch-switch 17 | if test -x $INIT && $INIT status; then 18 | $INIT restart || true 19 | fi 20 | 21 | exit 0 22 | 23 | 24 | -------------------------------------------------------------------------------- /rhel/etc_logrotate.d_openvswitch: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc. 2 | # 3 | # Copying and distribution of this file, with or without modification, 4 | # are permitted in any medium without royalty provided the copyright 5 | # notice and this notice are preserved. This file is offered as-is, 6 | # without warranty of any kind. 7 | 8 | /var/log/openvswitch/*.log { 9 | sharedscripts 10 | missingok 11 | postrotate 12 | # Tell Open vSwitch daemons to reopen their log files 13 | for pidfile in `cd /var/run/openvswitch && echo *.pid`; do 14 | ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 15 | done 16 | endscript 17 | } 18 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/rculist.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_RCULIST_WRAPPER_H 2 | #define __LINUX_RCULIST_WRAPPER_H 3 | 4 | #include 5 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) 6 | #include_next 7 | #else 8 | /* Prior to 2.6.26, the contents of rculist.h were part of list.h. */ 9 | #include 10 | #endif 11 | 12 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) 13 | #define hlist_del_init_rcu rpl_hlist_del_init_rcu 14 | static inline void hlist_del_init_rcu(struct hlist_node *n) 15 | { 16 | if (!hlist_unhashed(n)) { 17 | __hlist_del(n); 18 | n->pprev = NULL; 19 | } 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lib/leak-checker.man: -------------------------------------------------------------------------------- 1 | .TP 2 | \fB\-\-check\-leaks=\fIfile\fR 3 | . 4 | Logs information about memory allocation and deallocation to 5 | \fIfile\fR, to allow for debugging memory leaks in \fB\*(PN\fR. This 6 | option slows down \fB\*(PN\fR considerably, so it should only be used 7 | when a memory leak is suspected. Use the \fBovs\-parse\-leaks\fR script 8 | to interpret the leak file. 9 | .TP 10 | \fB\-\-leak\-limit=\fIsize\fR 11 | . 12 | Limits size of the leak file as specified by \fB\-\-check\-leaks\fR to 13 | \fIsize\fR bytes. Finding leaks sometimes requires allowing the leak 14 | file to grow very large, up to 1GB. By default, files are limited 15 | to 10MB. 16 | -------------------------------------------------------------------------------- /xenserver/etc_logrotate.d_openvswitch: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc. 2 | # 3 | # Copying and distribution of this file, with or without modification, 4 | # are permitted in any medium without royalty provided the copyright 5 | # notice and this notice are preserved. This file is offered as-is, 6 | # without warranty of any kind. 7 | 8 | /var/log/openvswitch/*.log { 9 | sharedscripts 10 | missingok 11 | postrotate 12 | # Tell Open vSwitch daemons to reopen their log files 13 | for pidfile in `cd /var/run/openvswitch && echo *.pid`; do 14 | ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 15 | done 16 | endscript 17 | } 18 | -------------------------------------------------------------------------------- /utilities/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | /nlmon 4 | /ovs-appctl 5 | /ovs-appctl.8 6 | /ovs-benchmark 7 | /ovs-benchmark.1 8 | /ovs-cfg-mod 9 | /ovs-cfg-mod.8 10 | /ovs-check-dead-ifs 11 | /ovs-controller 12 | /ovs-controller.8 13 | /ovs-ctl 14 | /ovs-dpctl 15 | /ovs-dpctl.8 16 | /ovs-l3ping 17 | /ovs-l3ping.8 18 | /ovs-lib 19 | /ovs-ofctl 20 | /ovs-ofctl.8 21 | /ovs-parse-backtrace 22 | /ovs-parse-leaks 23 | /ovs-pcap 24 | /ovs-pcap.1 25 | /ovs-pki 26 | /ovs-pki-cgi 27 | /ovs-pki.8 28 | /ovs-test 29 | /ovs-test.8 30 | /ovs-tcpundump 31 | /ovs-tcpundump.1 32 | /ovs-vlan-bug-workaround 33 | /ovs-vlan-bug-workaround.8 34 | /ovs-vlan-test 35 | /ovs-vlan-test.8 36 | /ovs-vsctl 37 | /ovs-vsctl.8 38 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/ovsdbmonitor.1: -------------------------------------------------------------------------------- 1 | .\" -*- nroff -*- 2 | .TH ovsdbmonitor 1 "May 2011" "Open vSwitch" "Open vSwitch Manual" 3 | . 4 | .SH NAME 5 | ovsdbmonitor \- GUI tool for monitoring Open vSwitch installations 6 | . 7 | .SH SYNOPSIS 8 | \fBovsdbmonitor\fR 9 | . 10 | .SH DESCRIPTION 11 | The \fBovsdbmonitor\fR program is a Qt-based GUI tool for monitoring 12 | and troubleshooting Open vSwitch. It presents GUI tables that 13 | graphically represent an Open vSwitch kernel flow table (similar to 14 | \fBovs\-dpctl dump\-flows\fR) and Open vSwitch database contents 15 | (similar to \fBovs\-vsctl list \fItable\fR). 16 | .SH "SEE ALSO" 17 | . 18 | \fBovsdb\-server\fR(1), 19 | \fBovsdb\-client\fR(1), 20 | and the OVSDB specification. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #*# 2 | *.a 3 | *.d 4 | *.ko 5 | *.la 6 | *.lo 7 | *.loT 8 | *.mod.c 9 | *.o 10 | *.o 11 | *.pyc 12 | *.so 13 | *~ 14 | *,cover 15 | .#* 16 | .*.cmd 17 | .*.swp 18 | .coverage 19 | .deps 20 | .dirstamp 21 | .libs 22 | .tmp_versions 23 | /Makefile 24 | /Makefile.in 25 | /aclocal.m4 26 | /all-distfiles 27 | /all-gitfiles 28 | /autom4te.cache 29 | /build-arch-stamp 30 | /build-indep-stamp 31 | /compile 32 | /config.guess 33 | /config.h 34 | /config.h.in 35 | /config.log 36 | /config.status 37 | /config.sub 38 | /configure 39 | /configure-stamp 40 | /depcomp 41 | /distfiles 42 | /install-sh 43 | /manpage-check 44 | /missing 45 | /missing-distfiles 46 | /package.m4 47 | /stamp-h1 48 | Module.symvers 49 | TAGS 50 | cscope.* 51 | tags 52 | -------------------------------------------------------------------------------- /utilities/ovs-pcap.1.in: -------------------------------------------------------------------------------- 1 | .TH ovs\-pcap 1 "@VERSION@" "Open vSwitch" "Open vSwitch Manual" 2 | . 3 | .SH NAME 4 | ovs\-pcap \- print packets from a pcap file as hex 5 | . 6 | .SH SYNOPSIS 7 | \fBovs\-pcap\fR \fIfile\fR 8 | .so lib/common-syn.man 9 | . 10 | .SH DESCRIPTION 11 | The \fBovs\-pcap\fR program reads the pcap \fIfile\fR named on the 12 | command line and prints each packet's contents as a sequence of hex 13 | digits on a line of its own. This format is suitable for use with the 14 | \fBofproto/trace\fR command supported by \fBovs\-vswitchd\fR(8). 15 | . 16 | .SH "OPTIONS" 17 | .so lib/common.man 18 | . 19 | .SH "SEE ALSO" 20 | . 21 | .BR ovs\-vswitchd (8), 22 | .BR ovs\-tcpundump (1), 23 | .BR tcpdump (8), 24 | .BR wireshark (8). 25 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | This file is included in compliance with the Apache 2.0 license, 2 | available at http://www.apache.org/licenses/LICENSE-2.0.html 3 | 4 | Open vSwitch 5 | Copyright (c) 2007, 2008, 2009, 2010, 2011 Nicira, Inc. 6 | 7 | Open vSwitch BSD port 8 | Copyright (c) 2011 Gaetano Catalli 9 | 10 | Apache Portable Runtime 11 | Copyright 2008 The Apache Software Foundation. 12 | 13 | This product includes software developed by 14 | The Apache Software Foundation (http://www.apache.org/). 15 | 16 | Portions of this software were developed at the National Center 17 | for Supercomputing Applications (NCSA) at the University of 18 | Illinois at Urbana-Champaign. 19 | 20 | lib/ovs.tmac includes troff macros written by Eric S. Raymond 21 | and Werner Lemberg. 22 | -------------------------------------------------------------------------------- /python/ovs/dirs.py.template: -------------------------------------------------------------------------------- 1 | ## The @variables@ in this file are replaced by default directories for 2 | ## use in python/ovs/dirs.py in the source directory and replaced by the 3 | ## configured directories for use in the installed python/ovs/dirs.py. 4 | ## 5 | import os 6 | PKGDATADIR = os.environ.get("OVS_PKGDATADIR", """@pkgdatadir@""") 7 | RUNDIR = os.environ.get("OVS_RUNDIR", """@RUNDIR@""") 8 | LOGDIR = os.environ.get("OVS_LOGDIR", """@LOGDIR@""") 9 | BINDIR = os.environ.get("OVS_BINDIR", """@bindir@""") 10 | 11 | DBDIR = os.environ.get("OVS_DBDIR") 12 | if not DBDIR: 13 | sysconfdir = os.environ.get("OVS_SYSCONFDIR") 14 | if sysconfdir: 15 | DBDIR = "%s/openvswitch" % sysconfdir 16 | else: 17 | DBDIR = """@DBDIR@""" 18 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | /Makefile 3 | /Makefile.in 4 | /atconfig 5 | /atlocal 6 | /idltest.c 7 | /idltest.h 8 | /idltest.ovsidl 9 | /ovs-pki.log 10 | /pki/ 11 | /test-aes128 12 | /test-bundle 13 | /test-byte-order 14 | /test-classifier 15 | /test-csum 16 | /test-file_name 17 | /test-flows 18 | /test-hash 19 | /test-heap 20 | /test-hmap 21 | /test-json 22 | /test-jsonrpc 23 | /test-list 24 | /test-lockfile 25 | /test-multipath 26 | /test-netflow 27 | /test-odp 28 | /test-ovsdb 29 | /test-packets 30 | /test-random 31 | /test-reconnect 32 | /test-sha1 33 | /test-stp 34 | /test-strtok_r 35 | /test-timeval 36 | /test-type-props 37 | /test-unix-socket 38 | /test-util 39 | /test-uuid 40 | /test-vconn 41 | /testsuite 42 | /testsuite.dir/ 43 | /testsuite.log 44 | -------------------------------------------------------------------------------- /tests/classifier.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([flow classifier unit tests]) 2 | m4_foreach( 3 | [testname], 4 | [[empty], 5 | [destroy-null], 6 | [single-rule], 7 | [rule-replacement], 8 | [many-rules-in-one-list], 9 | [many-rules-in-one-table], 10 | [many-rules-in-two-tables], 11 | [many-rules-in-five-tables]], 12 | [AT_SETUP([flow classifier - m4_bpatsubst(testname, [-], [ ])]) 13 | AT_CHECK([test-classifier testname], [0], [], []) 14 | AT_CLEANUP])]) 15 | 16 | AT_BANNER([miniflow unit tests]) 17 | m4_foreach( 18 | [testname], 19 | [[miniflow], 20 | [minimask_has_extra], 21 | [minimask_combine]], 22 | [AT_SETUP([miniflow - m4_bpatsubst(testname, [-], [ ])]) 23 | AT_CHECK([test-classifier testname], [0], [], []) 24 | AT_CLEANUP])]) 25 | -------------------------------------------------------------------------------- /tests/vconn.at: -------------------------------------------------------------------------------- 1 | m4_define([TEST_VCONN_CLASS], 2 | [AT_BANNER([vconn library -- $1 class]) 3 | m4_foreach( 4 | [testname], 5 | [[refuse-connection], 6 | [accept-then-close], 7 | [read-hello], 8 | [send-plain-hello], 9 | [send-long-hello], 10 | [send-echo-hello], 11 | [send-short-hello], 12 | [send-invalid-version-hello]], 13 | [AT_SETUP([$1 vconn - m4_bpatsubst(testname, [-], [ ])]) 14 | m4_if([$1], [ssl], [ 15 | AT_SKIP_IF([test "$HAVE_OPENSSL" = no]) 16 | AT_CHECK([cp $abs_top_builddir/tests/testpki*.pem .])]) 17 | AT_CHECK([test-vconn testname $1], [0], [], [ignore]) 18 | AT_CLEANUP])]) 19 | 20 | TEST_VCONN_CLASS([unix]) 21 | TEST_VCONN_CLASS([tcp]) 22 | TEST_VCONN_CLASS([ssl]) 23 | -------------------------------------------------------------------------------- /datapath/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = 2 | if LINUX_ENABLED 3 | SUBDIRS += linux 4 | endif 5 | 6 | EXTRA_DIST = $(dist_headers) $(dist_sources) $(dist_extras) 7 | 8 | # Suppress warnings about GNU extensions in Modules.mk files. 9 | AUTOMAKE_OPTIONS = -Wno-portability 10 | 11 | include Modules.mk 12 | include linux/Modules.mk 13 | 14 | # The following is based on commands for the Automake "distdir" target. 15 | distfiles: Makefile 16 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 17 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 18 | list='$(DISTFILES)'; \ 19 | for file in $$list; do echo $$file; done | \ 20 | sed -e "s|^$$srcdirstrip/||;t" \ 21 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@ 22 | CLEANFILES = distfiles 23 | -------------------------------------------------------------------------------- /lib/ssl-peer-ca-cert.man: -------------------------------------------------------------------------------- 1 | .IP "\fB\-\-peer\-ca\-cert=\fIpeer-cacert.pem\fR" 2 | Specifies a PEM file that contains one or more additional certificates 3 | to send to SSL peers. \fIpeer-cacert.pem\fR should be the CA 4 | certificate used to sign \fB\*(PN\fR's own certificate, that is, the 5 | certificate specified on \fB\-c\fR or \fB\-\-certificate\fR. If 6 | \fB\*(PN\fR's certificate is self-signed, then \fB\-\-certificate\fR 7 | and \fB\-\-peer\-ca\-cert\fR should specify the same file. 8 | .IP 9 | This option is not useful in normal operation, because the SSL peer 10 | must already have the CA certificate for the peer to have any 11 | confidence in \fB\*(PN\fR's identity. However, this offers a way for 12 | a new installation to bootstrap the CA certificate on its first SSL 13 | connection. 14 | -------------------------------------------------------------------------------- /ovsdb/remote-passive.man: -------------------------------------------------------------------------------- 1 | .IP "\fBpssl:\fIport\fR[\fB:\fIip\fR]" 2 | Listen on the given SSL \fIport\fR for a connection. By default, 3 | connections are not bound to a particular local IP address, but 4 | specifying \fIip\fR limits connections to those from the given 5 | \fIip\fR. The \fB\-\-private\-key\fR, \fB\-\-certificate\fR, and 6 | \fB\-\-ca\-cert\fR options are mandatory when this form is used. 7 | . 8 | .IP "\fBptcp:\fIport\fR[\fB:\fIip\fR]" 9 | Listen on the given TCP \fIport\fR for a connection. By default, 10 | connections are not bound to a particular local IP address, but 11 | \fIip\fR may be specified to listen only for connections to the given 12 | \fIip\fR. 13 | . 14 | .IP "\fBpunix:\fIfile\fR" 15 | Listen on the Unix domain server socket named \fIfile\fR for a 16 | connection. 17 | -------------------------------------------------------------------------------- /datapath/linux/.gitignore: -------------------------------------------------------------------------------- 1 | /Kbuild 2 | /Makefile 3 | /Makefile.main 4 | /Module.markers 5 | /actions.c 6 | /addrconf_core-openvswitch.c 7 | /checksum.c 8 | /dev-openvswitch.c 9 | /dp_sysfs_dp.c 10 | /dp_sysfs_if.c 11 | /datapath.c 12 | /dp_dev.c 13 | /dp_notify.c 14 | /exthdrs_core.c 15 | /flex_array.c 16 | /flow.c 17 | /genetlink-openvswitch.c 18 | /genl_exec.c 19 | /ip_output-openvswitch.c 20 | /kcompat.h 21 | /kmemdup.c 22 | /loop_counter.c 23 | /modules.order 24 | /netdevice.c 25 | /net_namespace.c 26 | /random32.c 27 | /reciprocal_div.c 28 | /skbuff-openvswitch.c 29 | /table.c 30 | /time.c 31 | /tmp 32 | /tunnel.c 33 | /vlan.c 34 | /vport-capwap.c 35 | /vport-generic.c 36 | /vport-gre.c 37 | /vport-internal_dev.c 38 | /vport-netdev.c 39 | /vport-patch.c 40 | /vport-vxlan.c 41 | /vport.c 42 | /workqueue.c 43 | -------------------------------------------------------------------------------- /vswitchd/xenserver.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef VSWITCHD_XENSERVER_H 17 | #define VSWITCHD_XENSERVER_H 1 18 | 19 | const char *xenserver_get_host_uuid(void); 20 | 21 | #endif /* xenserver.h */ 22 | -------------------------------------------------------------------------------- /include/sparse/arpa/inet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CHECKER__ 18 | #error "Use this header only with sparse. It is not a correct implementation." 19 | #endif 20 | 21 | #include 22 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-bond-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2012 Nicira, Inc. 18 | 19 | ovs-appctl bond/show 20 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-cfm-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2011 Nicira, Inc. 18 | 19 | ovs-appctl cfm/show 20 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-lacp-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2011 Nicira, Inc. 18 | 19 | ovs-appctl lacp/show 20 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-memory-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2012 Nicira, Inc. 18 | 19 | ovs-appctl memory/show 20 | -------------------------------------------------------------------------------- /lib/vconn-passive.man: -------------------------------------------------------------------------------- 1 | .IP "\fBpssl:\fR[\fIport\fR][\fB:\fIip\fR]" 2 | Listens for OpenFlow SSL connections on \fIport\fR (default: 6633). 3 | The \fB\-\-private\-key\fR, \fB\-\-certificate\fR, and 4 | \fB\-\-ca\-cert\fR options are mandatory when this form is used. By 5 | default, connections are not bound to a particular local IP address, 6 | but \fIip\fR may be specified to listen only for connections to the 7 | given \fIip\fR. 8 | . 9 | .IP "\fBptcp:\fR[\fIport\fR][\fB:\fIip\fR]" 10 | Listens for OpenFlow TCP connections on \fIport\fR (default: 6633). 11 | By default, connections are not bound to a particular local IP 12 | address, but \fIip\fR may be specified to listen only for connections 13 | to the given \fIip\fR. 14 | . 15 | .IP "\fBpunix:\fIfile\fR" 16 | Listens for OpenFlow connections on the Unix domain server socket 17 | named \fIfile\fR. 18 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-coverage-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2012 Nicira, Inc. 18 | 19 | ovs-appctl coverage/show 20 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-vsctl-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2012 Nicira, Inc. 18 | 19 | ovs-vsctl --timeout=5 show 20 | -------------------------------------------------------------------------------- /debian/control.modules.in: -------------------------------------------------------------------------------- 1 | Source: openvswitch 2 | Section: net 3 | Priority: extra 4 | Maintainer: Open vSwitch developers 5 | Build-Depends: debhelper (>= 5.0.37) 6 | Standards-Version: 3.7.3 7 | 8 | Package: openvswitch-datapath-module-_KVERS_ 9 | Architecture: any 10 | Recommends: kernel-image-_KVERS_, openvswitch-switch 11 | Provides: openvswitch-datapath-module 12 | Description: Open vSwitch Linux datapath kernel module 13 | This package contains the Open vSwitch loadable datapath kernel modules for 14 | the kernel-image-_KVERS_ package. 15 | . 16 | If you compiled a custom kernel, you will most likely need to compile 17 | a custom version of this module as well. The 18 | openvswitch-datapath-source package has been provided for this 19 | purpose. Refer to README.Debian provided in that package for further 20 | instructions. 21 | -------------------------------------------------------------------------------- /tests/timeval.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([timeval unit tests]) 2 | 3 | AT_SETUP([check that time advances]) 4 | AT_KEYWORDS([timeval]) 5 | AT_CHECK([test-timeval plain], [0]) 6 | AT_CLEANUP 7 | 8 | AT_SETUP([check that time advances after daemonize()]) 9 | AT_KEYWORDS([timeval]) 10 | AT_CHECK([test-timeval daemon], [0]) 11 | AT_CHECK( 12 | [# First try a quick sleep, so that the test completes very quickly 13 | # in the normal case. POSIX doesn't require fractional times to 14 | # work, so this might not work. 15 | sleep 0.1; if test -e test-timeval.success; then echo success; exit 0; fi 16 | # Then wait up to 2 seconds. 17 | sleep 1; if test -e test-timeval.success; then echo success; exit 0; fi 18 | sleep 1; if test -e test-timeval.success; then echo success; exit 0; fi 19 | echo failure; exit 1], 20 | [0], [success 21 | ], []) 22 | AT_CLEANUP 23 | -------------------------------------------------------------------------------- /lib/entropy.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef ENTROPY_H 17 | #define ENTROPY_H 1 18 | 19 | #include 20 | 21 | int get_entropy(void *, size_t); 22 | void get_entropy_or_die(void *, size_t); 23 | 24 | #endif /* entropy.h */ 25 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/slab.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_SLAB_WRAPPER_H 2 | #define __LINUX_SLAB_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_KMEMDUP 7 | extern void *kmemdup(const void *src, size_t len, gfp_t gfp); 8 | #endif 9 | 10 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) 11 | #define kmem_cache_create(n, s, a, f, c) kmem_cache_create(n, s, a, f, c, NULL) 12 | #endif 13 | 14 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) 15 | static inline void *rpl_kzalloc(size_t size, gfp_t flags) 16 | { 17 | return kzalloc(size, flags & ~__GFP_ZERO); 18 | } 19 | #define kzalloc rpl_kzalloc 20 | 21 | static inline void *rpl_kmalloc(size_t size, gfp_t flags) 22 | { 23 | if (flags & __GFP_ZERO) 24 | return kzalloc(size, flags); 25 | 26 | return kmalloc(size, flags); 27 | } 28 | #define kmalloc rpl_kmalloc 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /lib/ofp-version.man: -------------------------------------------------------------------------------- 1 | .de IQ 2 | . br 3 | . ns 4 | . IP "\\$1" 5 | .. 6 | .IP "\fB\-O \fR[\fIversion\fR[\fB,\fIversion\fR]...]\fR" 7 | .IQ "\fB\-\-protocols=\fR[\fIversion\fR[\fB,\fIversion\fR]...]\fR" 8 | Sets the OpenFlow protocol versions that are allowed when establishing 9 | an OpenFlow session. 10 | . 11 | .IP 12 | The following versions are considered to be ready for general use. 13 | These protocol versions are enabled by default: 14 | . 15 | .RS 16 | .IP \(bu 17 | \fBOpenFlow10\fR, for OpenFlow 1.0. 18 | .RE 19 | . 20 | .IP 21 | Support for the following protocol versions is provided for testing 22 | and development purposes. They are not enabled by default: 23 | . 24 | .RS 25 | .IP \(bu 26 | \fBOpenFlow11\fR, for OpenFlow 1.1. 27 | . 28 | .IP \(bu 29 | \fBOpenFlow12\fR, for OpenFlow 1.2. 30 | . 31 | .IP \(bu 32 | \fBOpenFlow13\fR, for OpenFlow 1.3. 33 | .RE 34 | -------------------------------------------------------------------------------- /lib/dhparams.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DHPARAMS_H 18 | #define DHPARAMS_H 1 19 | 20 | #include 21 | 22 | DH *get_dh1024(void); 23 | DH *get_dh2048(void); 24 | DH *get_dh4096(void); 25 | 26 | #endif /* dhparams.h */ 27 | -------------------------------------------------------------------------------- /datapath/linux/compat/ip_output-openvswitch.c: -------------------------------------------------------------------------------- 1 | #include 2 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 3 | 4 | #include 5 | #include 6 | 7 | int __ip_local_out(struct sk_buff *skb) 8 | { 9 | struct iphdr *iph = ip_hdr(skb); 10 | 11 | iph->tot_len = htons(skb->len); 12 | ip_send_check(iph); 13 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) 14 | return nf_hook(PF_INET, NF_IP_LOCAL_OUT, &skb, NULL, skb->dst->dev, 15 | dst_output); 16 | #else 17 | return nf_hook(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, skb->dst->dev, 18 | dst_output); 19 | #endif /* kernel < 2.6.24 */ 20 | } 21 | 22 | int ip_local_out(struct sk_buff *skb) 23 | { 24 | int err; 25 | 26 | err = __ip_local_out(skb); 27 | if (likely(err == 1)) 28 | err = dst_output(skb); 29 | 30 | return err; 31 | } 32 | 33 | #endif /* kernel < 2.6.25 */ 34 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-ovsdb-dump: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2011 Nicira, Inc. 18 | 19 | ovsdb-client -f csv dump unix:/var/run/openvswitch/db.sock Open_vSwitch 20 | -------------------------------------------------------------------------------- /lib/valgrind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef VALGRIND_H 18 | #define VALGRIND_H 1 19 | 20 | #ifdef HAVE_VALGRIND_VALGRIND_H 21 | #include 22 | #else 23 | #define RUNNING_ON_VALGRIND 0 24 | #endif 25 | 26 | #endif /* valgrind.h */ 27 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/kobject.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_KOBJECT_WRAPPER_H 2 | #define __LINUX_KOBJECT_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | 8 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 9 | #define kobject_init(kobj, ktype) rpl_kobject_init(kobj, ktype) 10 | static inline void rpl_kobject_init(struct kobject *kobj, struct kobj_type *ktype) 11 | { 12 | kobj->ktype = ktype; 13 | (kobject_init)(kobj); 14 | } 15 | 16 | #define kobject_add(kobj, parent, name) rpl_kobject_add(kobj, parent, name) 17 | static inline int rpl_kobject_add(struct kobject *kobj, 18 | struct kobject *parent, 19 | const char *name) 20 | { 21 | int err = kobject_set_name(kobj, "%s", name); 22 | if (err) 23 | return err; 24 | kobj->parent = parent; 25 | return (kobject_add)(kobj); 26 | } 27 | #endif 28 | 29 | 30 | #endif /* linux/kobject.h wrapper */ 31 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/ipv6.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_IPV6_WRAPPER_H 2 | #define __NET_IPV6_WRAPPER_H 1 3 | 4 | #include 5 | 6 | #include_next 7 | 8 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) 9 | #define ipv6_skip_exthdr rpl_ipv6_skip_exthdr 10 | extern int ipv6_skip_exthdr(const struct sk_buff *skb, int start, 11 | u8 *nexthdrp, __be16 *frag_offp); 12 | #endif 13 | 14 | enum { 15 | OVS_IP6T_FH_F_FRAG = (1 << 0), 16 | OVS_IP6T_FH_F_AUTH = (1 << 1), 17 | OVS_IP6T_FH_F_SKIP_RH = (1 << 2), 18 | }; 19 | 20 | /* This function is upstream, but not the version which skips routing 21 | * headers with 0 segments_left. We plan to propose the extended version. */ 22 | #define ipv6_find_hdr rpl_ipv6_find_hdr 23 | extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 24 | int target, unsigned short *fragoff, int *fragflg); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/sparse/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CHECKER__ 18 | #error "Use this header only with sparse. It is not a correct implementation." 19 | #endif 20 | 21 | extern void __ovs_assert(_Bool); 22 | #define assert(EXPRESSION) __ovs_assert(EXPRESSION) 23 | -------------------------------------------------------------------------------- /utilities/bugtool/plugins/kernel-info/openvswitch.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | /proc/slabinfo 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/uuidfilt.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | our %uuids; 7 | our $n_uuids = 0; 8 | sub lookup_uuid { 9 | my ($uuid) = @_; 10 | if (!exists($uuids{$uuid})) { 11 | $uuids{$uuid} = $n_uuids++; 12 | } 13 | return "<$uuids{$uuid}>"; 14 | } 15 | 16 | sub sort_set { 17 | my ($s) = @_; 18 | my (@uuids) = sort { $a <=> $b } (grep(/\d+/, split(/(\d+)/, $s))); 19 | return '["set",[' . join(',', map('["uuid","<' . $_ . '>"]', @uuids)) . ']]'; 20 | } 21 | 22 | my $u = '[0-9a-fA-F]'; 23 | my $uuid_re = "${u}{8}-${u}{4}-${u}{4}-${u}{4}-${u}{12}"; 24 | while (<>) { 25 | s/($uuid_re)/lookup_uuid($1)/eg; 26 | 27 | # Sort sets like this: 28 | # [["uuid","<1>"],["uuid","<0>"]] 29 | # to look like this: 30 | # [["uuid","<0>"],["uuid","<1>"]] 31 | s/(\["set",\[(,?\["uuid","<\d+>"\])+\]\])/sort_set($1)/ge; 32 | print $_; 33 | } 34 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/in.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_IN_WRAPPER_H 2 | #define __LINUX_IN_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_IPV4_IS_MULTICAST 7 | 8 | static inline bool ipv4_is_loopback(__be32 addr) 9 | { 10 | return (addr & htonl(0xff000000)) == htonl(0x7f000000); 11 | } 12 | 13 | static inline bool ipv4_is_multicast(__be32 addr) 14 | { 15 | return (addr & htonl(0xf0000000)) == htonl(0xe0000000); 16 | } 17 | 18 | static inline bool ipv4_is_local_multicast(__be32 addr) 19 | { 20 | return (addr & htonl(0xffffff00)) == htonl(0xe0000000); 21 | } 22 | 23 | static inline bool ipv4_is_lbcast(__be32 addr) 24 | { 25 | /* limited broadcast */ 26 | return addr == htonl(INADDR_BROADCAST); 27 | } 28 | 29 | static inline bool ipv4_is_zeronet(__be32 addr) 30 | { 31 | return (addr & htonl(0xff000000)) == htonl(0x00000000); 32 | } 33 | 34 | #endif /* !HAVE_IPV4_IS_MULTICAST */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /tests/choose-port.pl: -------------------------------------------------------------------------------- 1 | # -*- perl -*- 2 | 3 | # Picks a random TCP port and attempts to bind it, retrying a few 4 | # times if the chosen port is in use. This is better than just 5 | # picking a random number without checking whether it is in use (but 6 | # of course a race window still exists). 7 | # 8 | # On success, prints a port number on stdout and exits with status 0. 9 | # On failure, prints an error on stderr and exits with a nonzero status. 10 | 11 | use warnings; 12 | use strict; 13 | use Socket; 14 | 15 | socket(SOCK, PF_INET, SOCK_STREAM, 0) || die "socket: $!\n"; 16 | for (my ($i) = 0; ; $i++) { 17 | my ($port) = int(rand(16383)) + 49152; 18 | if (bind(SOCK, sockaddr_in($port, INADDR_ANY))) { 19 | print "$port\n"; 20 | exit 0; 21 | } elsif ($i < 10 && $!{EADDRINUSE}) { 22 | # Address already in use. Try again. 23 | } else { 24 | die "bind: $!\n"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | #ifndef HAVE_STRNLEN 22 | size_t 23 | strnlen(const char *s, size_t maxlen) 24 | { 25 | const char *end = memchr(s, '\0', maxlen); 26 | return end ? end - s : maxlen; 27 | } 28 | #endif 29 | -------------------------------------------------------------------------------- /python/ovs/timeval.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2009, 2010 Nicira, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import time 16 | 17 | 18 | def msec(): 19 | """Returns the current time, as the amount of time since the epoch, in 20 | milliseconds, as a float.""" 21 | return time.time() * 1000.0 22 | 23 | 24 | def postfork(): 25 | # Just a stub for now 26 | pass 27 | -------------------------------------------------------------------------------- /lib/sort.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef SORT_H 17 | #define SORT_H 1 18 | 19 | #include 20 | 21 | void sort(size_t count, 22 | int (*compare)(size_t a, size_t b, void *aux), 23 | void (*swap)(size_t a, size_t b, void *aux), 24 | void *aux); 25 | 26 | #endif /* sort.h */ 27 | -------------------------------------------------------------------------------- /vswitchd/system-stats.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010, 2012 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef VSWITCHD_SYSTEM_STATS 17 | #define VSWITCHD_SYSTEM_STATS 1 18 | 19 | #include 20 | 21 | void system_stats_enable(bool enable); 22 | struct smap *system_stats_run(void); 23 | void system_stats_wait(void); 24 | 25 | #endif /* vswitchd/system-stats.h */ 26 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/jiffies.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_JIFFIES_WRAPPER_H 2 | #define __LINUX_JIFFIES_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #include 7 | 8 | /* Same as above, but does so with platform independent 64bit types. 9 | * These must be used when utilizing jiffies_64 (i.e. return value of 10 | * get_jiffies_64() */ 11 | 12 | #ifndef time_after64 13 | #define time_after64(a, b) \ 14 | (typecheck(__u64, a) && \ 15 | typecheck(__u64, b) && \ 16 | ((__s64)(b) - (__s64)(a) < 0)) 17 | #endif 18 | 19 | #ifndef time_before64 20 | #define time_before64(a, b) time_after64(b, a) 21 | #endif 22 | 23 | #ifndef time_after_eq64 24 | #define time_after_eq64(a, b) \ 25 | (typecheck(__u64, a) && \ 26 | typecheck(__u64, b) && \ 27 | ((__s64)(a) - (__s64)(b) >= 0)) 28 | #endif 29 | 30 | #ifndef time_before_eq64 31 | #define time_before_eq64(a, b) time_after_eq64(b, a) 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /lib/lockfile.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, 2009 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef LOCKFILE_H 17 | #define LOCKFILE_H 1 18 | 19 | struct lockfile; 20 | 21 | char *lockfile_name(const char *file); 22 | int lockfile_lock(const char *file, struct lockfile **); 23 | void lockfile_unlock(struct lockfile *); 24 | void lockfile_postfork(void); 25 | 26 | #endif /* lib/lockfile.h */ 27 | -------------------------------------------------------------------------------- /datapath/linux/compat/dev-openvswitch.c: -------------------------------------------------------------------------------- 1 | #ifndef HAVE_DEV_DISABLE_LRO 2 | 3 | #include 4 | 5 | #ifdef NETIF_F_LRO 6 | #include 7 | 8 | /** 9 | * dev_disable_lro - disable Large Receive Offload on a device 10 | * @dev: device 11 | * 12 | * Disable Large Receive Offload (LRO) on a net device. Must be 13 | * called under RTNL. This is needed if received packets may be 14 | * forwarded to another interface. 15 | */ 16 | void dev_disable_lro(struct net_device *dev) 17 | { 18 | if (dev->ethtool_ops && dev->ethtool_ops->get_flags && 19 | dev->ethtool_ops->set_flags) { 20 | u32 flags = dev->ethtool_ops->get_flags(dev); 21 | if (flags & ETH_FLAG_LRO) { 22 | flags &= ~ETH_FLAG_LRO; 23 | dev->ethtool_ops->set_flags(dev, flags); 24 | } 25 | } 26 | WARN_ON(dev->features & NETIF_F_LRO); 27 | } 28 | #else 29 | void dev_disable_lro(struct net_device *dev) { } 30 | #endif /* NETIF_F_LRO */ 31 | 32 | #endif /* HAVE_DEV_DISABLE_LRO */ 33 | -------------------------------------------------------------------------------- /include/openflow/openflow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef OPENFLOW_OPENFLOW_H 18 | #define OPENFLOW_OPENFLOW_H 1 19 | 20 | #include "openflow/openflow-1.0.h" 21 | #include "openflow/openflow-1.1.h" 22 | #include "openflow/openflow-1.2.h" 23 | #include "openflow/openflow-1.3.h" 24 | 25 | #endif /* openflow/openflow.h */ 26 | -------------------------------------------------------------------------------- /datapath/linux/Kbuild.in: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | export builddir = @abs_builddir@ 3 | export srcdir = @abs_srcdir@ 4 | export top_srcdir = @abs_top_srcdir@ 5 | export VERSION = @VERSION@ 6 | 7 | include $(srcdir)/../Modules.mk 8 | include $(srcdir)/Modules.mk 9 | 10 | EXTRA_CFLAGS := -DVERSION=\"$(VERSION)\" 11 | EXTRA_CFLAGS += -I$(srcdir)/.. 12 | EXTRA_CFLAGS += -I$(builddir)/.. 13 | EXTRA_CFLAGS += -g 14 | EXTRA_CFLAGS += -include $(builddir)/kcompat.h 15 | 16 | # These include directories have to go before -I$(KSRC)/include. 17 | # NOSTDINC_FLAGS just happens to be a variable that goes in the 18 | # right place, even though it's conceptually incorrect. 19 | NOSTDINC_FLAGS += -I$(top_srcdir)/include -I$(srcdir)/compat -I$(srcdir)/compat/include 20 | 21 | obj-m := $(patsubst %,%.o,$(build_modules)) 22 | 23 | define module_template 24 | $(1)-y = $$(notdir $$(patsubst %.c,%.o,$($(1)_sources))) 25 | endef 26 | 27 | $(foreach module,$(build_modules),$(eval $(call module_template,$(module)))) 28 | -------------------------------------------------------------------------------- /lib/backtrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef BACKTRACE_H 18 | #define BACKTRACE_H 1 19 | 20 | #include 21 | 22 | #define BACKTRACE_MAX_FRAMES 31 23 | 24 | struct backtrace { 25 | int n_frames; 26 | uintptr_t frames[BACKTRACE_MAX_FRAMES]; 27 | }; 28 | 29 | void backtrace_capture(struct backtrace *); 30 | 31 | #endif /* backtrace.h */ 32 | -------------------------------------------------------------------------------- /tests/valgrind-wrapper.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | wrap_program=`basename '@wrap_program@'` 4 | 5 | # Strip the first directory from $PATH that contains $wrap_program, 6 | # so that below we run the real $wrap_program, not ourselves. 7 | not_found=true 8 | new_path= 9 | first=true 10 | save_IFS=$IFS 11 | IFS=: 12 | for dir in $PATH; do 13 | IFS=$save_IFS 14 | if $not_found && test -x "$dir/$wrap_program"; then 15 | not_found=false 16 | else 17 | if $first; then 18 | first=false 19 | new_path=$dir 20 | else 21 | new_path=$new_path:$dir 22 | fi 23 | fi 24 | done 25 | IFS=$save_IFS 26 | if $not_found; then 27 | echo "$0: error: cannot find $wrap_program in \$PATH" >&2 28 | exit 1 29 | fi 30 | PATH=$new_path 31 | export PATH 32 | 33 | : ${VALGRIND:=valgrind -q --log-file=valgrind.%p --leak-check=full} 34 | exec $VALGRIND $wrap_program "$@" 35 | echo "$0: failed to execute $VALGRIND $wrap_program" "$@" >&2 36 | exit 1 37 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-daemons-ver: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2012 Nicira, Inc. 18 | 19 | for f in `cd /var/run/openvswitch/; ls *.pid 2>/dev/null` 20 | do 21 | if [ -n "${f%.pid}" ]; then 22 | ovs-appctl -t "${f%.pid}" version 2>&1 23 | fi 24 | echo 25 | done 26 | -------------------------------------------------------------------------------- /rhel/usr_share_openvswitch_scripts_sysconfig.template: -------------------------------------------------------------------------------- 1 | ### Configuration options for openvswitch 2 | 3 | # Copyright (C) 2009, 2010, 2011 Nicira, Inc. 4 | 5 | # FORCE_COREFILES: If 'yes' then core files will be enabled. 6 | # FORCE_COREFILES=yes 7 | 8 | # OVSDB_SERVER_PRIORITY: "nice" priority at which to run ovsdb-server. 9 | # 10 | # OVSDB_SERVER_PRIORITY=-10 11 | 12 | # VSWITCHD_PRIORITY: "nice" priority at which to run ovs-vswitchd. 13 | # VSWITCHD_PRIORITY=-10 14 | 15 | # VSWITCHD_MLOCKALL: Whether to pass ovs-vswitchd the --mlockall option. 16 | # This option should be set to "yes" or "no". The default is "yes". 17 | # Enabling this option can avoid networking interruptions due to 18 | # system memory pressure in extraordinary situations, such as multiple 19 | # concurrent VM import operations. 20 | # VSWITCHD_MLOCKALL=yes 21 | 22 | # OVS_CTL_OPTS: Extra options to pass to ovs-ctl. This is, for example, 23 | # a suitable place to specify --ovs-vswitchd-wrapper=valgrind. 24 | # OVS_CTL_OPTS= 25 | -------------------------------------------------------------------------------- /xenserver/usr_share_openvswitch_scripts_sysconfig.template: -------------------------------------------------------------------------------- 1 | ### Configuration options for openvswitch 2 | 3 | # Copyright (C) 2009, 2010, 2011 Nicira, Inc. 4 | 5 | # FORCE_COREFILES: If 'yes' then core files will be enabled. 6 | # FORCE_COREFILES=yes 7 | 8 | # OVSDB_SERVER_PRIORITY: "nice" priority at which to run ovsdb-server. 9 | # 10 | # OVSDB_SERVER_PRIORITY=-10 11 | 12 | # VSWITCHD_PRIORITY: "nice" priority at which to run ovs-vswitchd. 13 | # VSWITCHD_PRIORITY=-10 14 | 15 | # VSWITCHD_MLOCKALL: Whether to pass ovs-vswitchd the --mlockall option. 16 | # This option should be set to "yes" or "no". The default is "yes". 17 | # Enabling this option can avoid networking interruptions due to 18 | # system memory pressure in extraordinary situations, such as multiple 19 | # concurrent VM import operations. 20 | # VSWITCHD_MLOCKALL=yes 21 | 22 | # OVS_CTL_OPTS: Extra options to pass to ovs-ctl. This is, for example, 23 | # a suitable place to specify --ovs-vswitchd-wrapper=valgrind. 24 | # OVS_CTL_OPTS= 25 | -------------------------------------------------------------------------------- /lib/pcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PCAP_H 18 | #define PCAP_H 1 19 | 20 | #include 21 | 22 | struct ofpbuf; 23 | 24 | FILE *pcap_open(const char *file_name, const char *mode); 25 | int pcap_read_header(FILE *); 26 | void pcap_write_header(FILE *); 27 | int pcap_read(FILE *, struct ofpbuf **); 28 | void pcap_write(FILE *, struct ofpbuf *); 29 | 30 | #endif /* dhcp.h */ 31 | -------------------------------------------------------------------------------- /utilities/ovs-tcpundump.1.in: -------------------------------------------------------------------------------- 1 | .TH ovs\-tcpundump 1 "@VERSION@" "Open vSwitch" "Open vSwitch Manual" 2 | . 3 | .SH NAME 4 | ovs\-tcpundump \- convert ``tcpdump \-xx'' output to hex strings 5 | . 6 | .SH SYNOPSIS 7 | \fBovs\-tcpundump < \fIfile\fR 8 | .so lib/common-syn.man 9 | . 10 | .SH DESCRIPTION 11 | The \fBovs\-tcpundump\fR program reads \fBtcpdump \-xx\fR output on 12 | stdin, looking for hexadecimal packet data, and dumps each Ethernet as 13 | a single hexadecimal string on stdout. This format is suitable for 14 | use with the \fBofproto/trace\fR command supported by 15 | \fBovs\-vswitchd\fR(8) 16 | via \fBovs\-appctl\fR(8). 17 | .PP 18 | At least two \fB\-x\fR or \fB\-X\fR options must be given, otherwise 19 | the output will omit the Ethernet header, which prevents the output 20 | from being using with \fBofproto/trace\fR. 21 | . 22 | .SH "OPTIONS" 23 | .so lib/common.man 24 | . 25 | .SH "SEE ALSO" 26 | . 27 | .BR ovs\-appctl (8), 28 | .BR ovs\-vswitchd (8), 29 | .BR ovs\-pcap (1), 30 | .BR tcpdump (8), 31 | .BR wireshark (8). 32 | -------------------------------------------------------------------------------- /debian/openvswitch-datapath-source.README.Debian: -------------------------------------------------------------------------------- 1 | Open vSwitch for Debian 2 | ---------------------- 3 | 4 | * How do I build this module the Debian way? 5 | 6 | - Building with module-assistant: 7 | 8 | $ module-assistant auto-install openvswitch-datapath 9 | or 10 | $ m-a a-i openvswitch-datapath 11 | 12 | If kernel source or headers are in a non-standard directory, add 13 | the option -k /path/to/kernel/source with the correct path. 14 | 15 | - Building with make-kpkg 16 | 17 | $ cd /usr/src/ 18 | $ tar jxvf openvswitch.tar.bz2 19 | $ cd /usr/src/kernel-source-2.6.26 20 | $ make-kpkg --added-modules=openvswitch modules 21 | 22 | - Building without make-kpkg 23 | 24 | $ cd /usr/src/ 25 | $ tar jxvf openvswitch.tar.bz2 26 | $ cd modules/openvswitch 27 | $ fakeroot debian/rules kdist_image 28 | 29 | If you run this as root, fakeroot is not needed. 30 | 31 | -- Ben Pfaff , Wed, 22 Jun 2011 09:51:28 -0700 32 | -------------------------------------------------------------------------------- /utilities/bugtool/plugins/system-configuration/openvswitch.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | date --rfc-3339=seconds 21 | /usr/share/openvswitch/scripts/ovs-bugtool-daemons-ver 22 | 23 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/netlink.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_NETLINK_WRAPPER_H 2 | #define __LINUX_NETLINK_WRAPPER_H 1 3 | 4 | #include 5 | #include_next 6 | 7 | #ifndef NLA_TYPE_MASK 8 | #define NLA_F_NESTED (1 << 15) 9 | #define NLA_F_NET_BYTEORDER (1 << 14) 10 | #define NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)) 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | #ifndef NLMSG_DEFAULT_SIZE 17 | #define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) 18 | #endif 19 | 20 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) 21 | #define nlmsg_new(s, f) nlmsg_new_proper((s), (f)) 22 | static inline struct sk_buff *nlmsg_new_proper(int size, gfp_t flags) 23 | { 24 | return alloc_skb(size, flags); 25 | } 26 | #endif /* linux kernel < 2.6.19 */ 27 | 28 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) 29 | static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb) 30 | { 31 | return (struct nlmsghdr *)skb->data; 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /vswitchd/bridge.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef VSWITCHD_BRIDGE_H 17 | #define VSWITCHD_BRIDGE_H 1 18 | 19 | struct simap; 20 | 21 | void bridge_init(const char *remote); 22 | void bridge_exit(void); 23 | 24 | void bridge_run(void); 25 | void bridge_run_fast(void); 26 | void bridge_wait(void); 27 | 28 | void bridge_get_memory_usage(struct simap *usage); 29 | 30 | #endif /* bridge.h */ 31 | -------------------------------------------------------------------------------- /datapath/genl_exec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2012 Nicira, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of version 2 of the GNU General Public 6 | * License as published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 | * 02110-1301, USA 17 | */ 18 | 19 | #ifndef GENL_EXEC_H 20 | #define GENL_EXEC_H 1 21 | 22 | typedef int (*genl_exec_func_t)(void *data); 23 | int genl_exec(genl_exec_func_t func, void *data); 24 | int genl_exec_init(void); 25 | void genl_exec_exit(void); 26 | 27 | #endif /* genl_exec.h */ 28 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/etherdevice.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_ETHERDEVICE_WRAPPER_H 2 | #define __LINUX_ETHERDEVICE_WRAPPER_H 1 3 | 4 | #include 5 | #include_next 6 | 7 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) 8 | static inline void eth_hw_addr_random(struct net_device *dev) 9 | { 10 | random_ether_addr(dev->dev_addr); 11 | } 12 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0) 13 | static inline void eth_hw_addr_random(struct net_device *dev) 14 | { 15 | dev_hw_addr_random(dev, dev->dev_addr); 16 | } 17 | #endif 18 | 19 | #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) 20 | #define eth_mac_addr rpl_eth_mac_addr 21 | static inline int eth_mac_addr(struct net_device *dev, void *p) 22 | { 23 | struct sockaddr *addr = p; 24 | 25 | if (!is_valid_ether_addr(addr->sa_data)) 26 | return -EADDRNOTAVAIL; 27 | #ifdef NET_ADDR_RANDOM 28 | dev->addr_assign_type &= ~NET_ADDR_RANDOM; 29 | #endif 30 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); 31 | return 0; 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /utilities/bugtool/plugins/system-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 22 | -------------------------------------------------------------------------------- /lib/dummy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DUMMY_H 18 | #define DUMMY_H 1 19 | 20 | #include 21 | 22 | /* For client programs to call directly to enable dummy support. */ 23 | void dummy_enable(bool override); 24 | 25 | /* Implementation details. */ 26 | void dpif_dummy_register(bool override); 27 | void netdev_dummy_register(bool override); 28 | void timeval_dummy_register(void); 29 | 30 | #endif /* dummy.h */ 31 | -------------------------------------------------------------------------------- /debian/rules.modules: -------------------------------------------------------------------------------- 1 | #! /usr/bin/make -f 2 | 3 | PACKAGE=openvswitch-datapath-module 4 | MA_DIR ?= /usr/share/modass 5 | -include $(MA_DIR)/include/generic.make 6 | -include $(MA_DIR)/include/common-rules.make 7 | 8 | DATAPATH_CONFIGURE_OPTS = 9 | 10 | kdist_clean: 11 | dh_testdir 12 | dh_testroot 13 | dh_clean 14 | rm -rf openvswitch 15 | 16 | .PHONY: kdist_config 17 | kdist_config: prep-deb-files 18 | 19 | .PHONY: binary-modules 20 | binary-modules: DSTDIR = $(CURDIR)/debian/$(PKGNAME)/lib/modules/$(KVERS)/kernel 21 | binary-modules: prep-deb-files 22 | dh_testdir 23 | dh_testroot 24 | dh_clean -k 25 | tar xzf openvswitch.tar.gz 26 | cd openvswitch && ./configure --with-linux=$(KSRC) $(DATAPATH_CONFIGURE_OPTS) 27 | cd openvswitch && $(MAKE) -C datapath/linux 28 | install -d -m755 $(DSTDIR) 29 | install -m644 openvswitch/datapath/linux/*.ko $(DSTDIR)/ 30 | dh_installmodules 31 | dh_installdocs 32 | dh_installchangelogs 33 | dh_compress 34 | dh_fixperms 35 | dh_installdeb 36 | dh_gencontrol 37 | dh_md5sums 38 | dh_builddeb --destdir=$(DEB_DESTDIR) 39 | 40 | -------------------------------------------------------------------------------- /lib/ofp-version-opt.h: -------------------------------------------------------------------------------- 1 | #ifndef OFP_VERSION_H 2 | #define OFP_VERSION_H 1 3 | 4 | #include 5 | #include "util.h" 6 | #include "ofp-util.h" 7 | 8 | #define OFP_VERSION_LONG_OPTIONS \ 9 | {"version", no_argument, NULL, 'V'}, \ 10 | {"protocols", required_argument, NULL, 'O'} 11 | 12 | #define OFP_VERSION_OPTION_HANDLERS \ 13 | case 'V': \ 14 | ovs_print_version(OFP10_VERSION, OFP13_VERSION); \ 15 | exit(EXIT_SUCCESS); \ 16 | \ 17 | case 'O': \ 18 | set_allowed_ofp_versions(optarg); \ 19 | break; 20 | 21 | uint32_t get_allowed_ofp_versions(void); 22 | void set_allowed_ofp_versions(const char *string); 23 | void mask_allowed_ofp_versions(uint32_t); 24 | void ofp_version_usage(void); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lib/dh4096.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIICCAKCAgEA+hRyUsFN4VpJ1O8JLcCo/VWr19k3BCgJ4uk+d+KhehjdRqNDNyOQ 3 | l/MOyQNQfWXPeGKmOmIig6Ev/nm6Nf9Z2B1h3R4hExf+zTiHnvVPeRBhjdQi81rt 4 | Xeoh6TNrSBIKIHfUJWBh3va0TxxjQIs6IZOLeVNRLMqzeylWqMf49HsIXqbcokUS 5 | Vt1BkvLdW48j8PPv5DsKRN3tloTxqDJGo9tKvj1Fuk74A+Xda1kNhB7KFlqMyN98 6 | VETEJ6c7KpfOo30mnK30wqw3S8OtaIR/maYX72tGOno2ehFDkq3pnPtEbD2CScxc 7 | alJC+EL7RPk5c/tgeTvCngvc1KZn92Y//EI7G9tPZtylj2b56sHtMftIoYJ9+ODM 8 | sccD5Piz/rejE3Ome8EOOceUSCYAhXn8b3qvxVI1ddd1pED6FHRhFvLrZxFvBEM9 9 | ERRMp5QqOaHJkM+Dxv8Cj6MqrCbfC4u+ZErxodzuusgDgvZiLF22uxMZbobFWyte 10 | OvOzKGtwcTqO/1wV5gKkzu1ZVswVUQd5Gg8lJicwqRWyyNRczDDoG9jVDxmogKTH 11 | AaqLulO7R8Ifa1SwF2DteSGVtgWEN8gDpN3RBmmPTDngyF2DHb5qmpnznwtFKdTL 12 | KWbuHn491xNO25CQWMtem80uKw+pTnisBRF/454n1Jnhub144YRBoN8CAQI= 13 | -----END DH PARAMETERS----- 14 | 15 | These are the 4096 bit DH parameters from "Assigned Number for SKIP Protocols" 16 | (http://www.skip-vpn.org/spec/numbers.html). 17 | See there for how they were generated. 18 | Note that g is not a generator, but this is not a problem since p is a safe prime. 19 | -------------------------------------------------------------------------------- /utilities/ovs-vlan-bugs.man: -------------------------------------------------------------------------------- 1 | .IP \(bu 2 | When NICs use VLAN stripping on receive they must pass a pointer to a 3 | \fBvlan_group\fR when reporting the stripped tag to the networking 4 | core. If no \fBvlan_group\fR is in use then some drivers just drop 5 | the extracted tag. Drivers are supposed to only enable stripping if a 6 | \fBvlan_group\fR is registered but not all of them do that. 7 | . 8 | .IP \(bu 9 | On receive, some drivers handle priority tagged packets specially and 10 | don't pass the tag onto the network stack at all, so Open vSwitch 11 | never has a chance to see it. 12 | . 13 | .IP \(bu 14 | Some drivers size their receive buffers based on whether a 15 | \fBvlan_group\fR is enabled, meaning that a maximum size packet with a 16 | VLAN tag will not fit if no \fBvlan_group\fR is configured. 17 | . 18 | .IP \(bu 19 | On transmit, some drivers expect that VLAN acceleration will be used 20 | if it is available, which can only be done if a \fBvlan_group\fR is 21 | configured. In these cases, the driver may fail to parse the packet 22 | and correctly setup checksum offloading or TSO. 23 | -------------------------------------------------------------------------------- /datapath/vport-internal_dev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2011 Nicira, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of version 2 of the GNU General Public 6 | * License as published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 | * 02110-1301, USA 17 | */ 18 | 19 | #ifndef VPORT_INTERNAL_DEV_H 20 | #define VPORT_INTERNAL_DEV_H 1 21 | 22 | #include "datapath.h" 23 | #include "vport.h" 24 | 25 | int ovs_is_internal_dev(const struct net_device *); 26 | struct vport *ovs_internal_dev_get_vport(struct net_device *); 27 | 28 | #endif /* vport-internal_dev.h */ 29 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool-tc-class-show: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of version 2.1 of the GNU Lesser General 5 | # Public License as published by the Free Software Foundation. 6 | # 7 | # This library is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | # Lesser General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU Lesser General Public 13 | # License along with this library; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 | # USA 16 | # 17 | # Copyright (C) 2011 Nicira, Inc. 18 | 19 | for iface in $(cd /sys/class/net && echo *); do 20 | if [ -d /sys/class/net/$iface ]; then 21 | echo Interface $iface: 22 | # indent tc output so it's clear which interface it pertains to 23 | /sbin/tc -s -d class show dev $iface | /bin/sed 's/^/ /' 24 | fi 25 | done 26 | -------------------------------------------------------------------------------- /utilities/bugtool/plugins/system-logs/openvswitch.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | /etc/openvswitch 21 | /var/lib/openvswitch 22 | 23 | -------------------------------------------------------------------------------- /lib/random.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef RANDOM_H 18 | #define RANDOM_H 1 19 | 20 | #include 21 | #include 22 | 23 | void random_init(void); 24 | void random_set_seed(uint32_t); 25 | 26 | void random_bytes(void *, size_t); 27 | uint8_t random_uint8(void); 28 | uint16_t random_uint16(void); 29 | uint32_t random_uint32(void); 30 | uint64_t random_uint64(void); 31 | int random_range(int max); 32 | 33 | #endif /* random.h */ 34 | -------------------------------------------------------------------------------- /lib/ssl-bootstrap.man: -------------------------------------------------------------------------------- 1 | .IP "\fB\-\-bootstrap\-ca\-cert=\fIcacert.pem\fR" 2 | When \fIcacert.pem\fR exists, this option has the same effect as 3 | \fB\-C\fR or \fB\-\-ca\-cert\fR. If it does not exist, then 4 | \fB\*(PN\fR will attempt to obtain the CA certificate from the 5 | SSL peer on its first SSL connection and save it to the named PEM 6 | file. If it is successful, it will immediately drop the connection 7 | and reconnect, and from then on all SSL connections must be 8 | authenticated by a certificate signed by the CA certificate thus 9 | obtained. 10 | .IP 11 | \fBThis option exposes the SSL connection to a man-in-the-middle 12 | attack obtaining the initial CA certificate\fR, but it may be useful 13 | for bootstrapping. 14 | .IP 15 | This option is only useful if the SSL peer sends its CA certificate as 16 | part of the SSL certificate chain. The SSL protocol does not require 17 | the server to send the CA certificate, but 18 | \fB\*(SN\fR(8) can be configured to do so with the 19 | \fB\-\-peer\-ca\-cert\fR option. 20 | .IP 21 | This option is mutually exclusive with \fB\-C\fR and 22 | \fB\-\-ca\-cert\fR. 23 | -------------------------------------------------------------------------------- /datapath/vport-capwap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nicira, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of version 2 of the GNU General Public 6 | * License as published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 | * 02110-1301, USA 17 | */ 18 | 19 | #ifndef VPORT_CAPWAP_H 20 | #define VPORT_CAPWAP_H 1 21 | 22 | #include 23 | 24 | struct capwap_net { 25 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) 26 | struct socket *capwap_rcv_socket; 27 | struct netns_frags frag_state; 28 | int n_tunnels; 29 | #endif 30 | }; 31 | 32 | #endif /* vport-capwap.h */ 33 | -------------------------------------------------------------------------------- /tests/test-file_name.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "util.h" 19 | #include 20 | 21 | int 22 | main(int argc, char *argv[]) 23 | { 24 | int i; 25 | 26 | for (i = 1; i < argc; i++) { 27 | char *dir, *base; 28 | 29 | dir = dir_name(argv[i]); 30 | puts(dir); 31 | free(dir); 32 | 33 | base = base_name(argv[i]); 34 | puts(base); 35 | free(base); 36 | } 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /utilities/ovs-parse-backtrace.8: -------------------------------------------------------------------------------- 1 | .TH ovs\-parse\-backtrace 8 "October 2012" "Open vSwitch" "Open vSwitch Manual" 2 | . 3 | .SH NAME 4 | ovs\-parse\-backtrace \- parses ovs-appctl backtrace output 5 | . 6 | .SH SYNOPSIS 7 | \fBovs\-appctl backtrace\fR | \fBovs\-parse\-backtrace\fR [\fIbinary\fR] 8 | .P 9 | \fBovs\-parse\-backtrace\fR [\fIbinary\fR] < \fIbacktrace\fR 10 | . 11 | .SH DESCRIPTION 12 | In some configurations, many Open vSwitch daemons can produce a series of 13 | backtraces using the \fBovs\-appctl backtrace\fR command. Users can analyze 14 | these backtraces to figure out what the given Open vSwitch daemon may be 15 | spending most of its time doing. \fBovs\-parse\-backtrace\fR makes this output 16 | easier to interpret. 17 | .PP 18 | The \fBovs\-appctl backtrace\fR output must be supplied on standard input. The 19 | binary that produced the output should be supplied as the sole non-option 20 | argument. For best results, the binary should have debug symbols. 21 | . 22 | .SH OPTIONS 23 | .TP 24 | \fB\-\-help\fR 25 | Prints a usage message and exits. 26 | .P 27 | \fB\-\-version\fR 28 | Prints the version and exits. 29 | -------------------------------------------------------------------------------- /debian/openvswitch-controller.default: -------------------------------------------------------------------------------- 1 | # This is a POSIX shell fragment -*- sh -*- 2 | 3 | # LISTEN: What OpenFlow connection methods should the controller listen on? 4 | # 5 | # This is a space-delimited list of connection methods: 6 | # 7 | # * "pssl:[PORT]": Listen for SSL connections on the specified PORT 8 | # (default: 6633). The private key, certificate, and CA certificate 9 | # must be specified below. 10 | # 11 | # * "ptcp:[PORT]": Listen for TCP connections on the specified PORT 12 | # (default: 6633). Not recommended for security reasons. 13 | # 14 | LISTEN="pssl:" 15 | 16 | # PRIVKEY: Name of file containing controller's private key. 17 | # Required if SSL enabled. 18 | PRIVKEY=/etc/openvswitch-controller/privkey.pem 19 | 20 | # CERT: Name of file containing certificate for private key. 21 | # Required if SSL enabled. 22 | CERT=/etc/openvswitch-controller/cert.pem 23 | 24 | # CACERT: Name of file containing switch CA certificate. 25 | # Required if SSL enabled. 26 | CACERT=/etc/openvswitch-controller/cacert.pem 27 | 28 | # Additional options to pass to controller, e.g. "--hub" 29 | DAEMON_OPTS="" 30 | -------------------------------------------------------------------------------- /datapath/linux/compat/time.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) 6 | 7 | /* "set_normalized_timespec" is defined but not exported in kernels 8 | * before 2.6.26. */ 9 | 10 | /** 11 | * set_normalized_timespec - set timespec sec and nsec parts and normalize 12 | * 13 | * @ts: pointer to timespec variable to be set 14 | * @sec: seconds to set 15 | * @nsec: nanoseconds to set 16 | * 17 | * Set seconds and nanoseconds field of a timespec variable and 18 | * normalize to the timespec storage format 19 | * 20 | * Note: The tv_nsec part is always in the range of 21 | * 0 <= tv_nsec < NSEC_PER_SEC 22 | * For negative values only the tv_sec field is negative ! 23 | */ 24 | void set_normalized_timespec(struct timespec *ts, 25 | time_t sec, long nsec) 26 | { 27 | while (nsec >= NSEC_PER_SEC) { 28 | nsec -= NSEC_PER_SEC; 29 | ++sec; 30 | } 31 | while (nsec < 0) { 32 | nsec += NSEC_PER_SEC; 33 | --sec; 34 | } 35 | ts->tv_sec = sec; 36 | ts->tv_nsec = nsec; 37 | } 38 | 39 | #endif /* linux kernel < 2.6.26 */ 40 | -------------------------------------------------------------------------------- /lib/ofp-version-opt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ofp-util.h" 3 | #include "ofp-version-opt.h" 4 | #include "vlog.h" 5 | #include "dynamic-string.h" 6 | 7 | VLOG_DEFINE_THIS_MODULE(ofp_version); 8 | 9 | static uint32_t allowed_versions = 0; 10 | 11 | uint32_t 12 | get_allowed_ofp_versions(void) 13 | { 14 | return allowed_versions ? allowed_versions : OFPUTIL_DEFAULT_VERSIONS; 15 | } 16 | 17 | void 18 | set_allowed_ofp_versions(const char *string) 19 | { 20 | allowed_versions = ofputil_versions_from_string(string); 21 | } 22 | 23 | void 24 | mask_allowed_ofp_versions(uint32_t bitmap) 25 | { 26 | allowed_versions &= bitmap; 27 | } 28 | 29 | void 30 | ofp_version_usage(void) 31 | { 32 | struct ds msg = DS_EMPTY_INITIALIZER; 33 | 34 | ofputil_format_version_bitmap_names(&msg, OFPUTIL_DEFAULT_VERSIONS); 35 | printf( 36 | "\nOpen Flow Version options:\n" 37 | " -V, --version display version information\n" 38 | " -O, --protocols set allowed Open Flow versions\n" 39 | " (default: %s)\n", 40 | ds_cstr(&msg)); 41 | ds_destroy(&msg); 42 | } 43 | -------------------------------------------------------------------------------- /include/sparse/sys/wait.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CHECKER__ 18 | #error "Use this header only with sparse. It is not a correct implementation." 19 | #endif 20 | 21 | #ifndef __SYS_WAIT_SPARSE 22 | #define __SYS_WAIT_SPARSE 1 23 | 24 | #include_next 25 | 26 | #undef wait 27 | #define wait(a) rpl_wait(a) 28 | pid_t rpl_wait(int *); 29 | 30 | #undef waitpid 31 | #define waitpid(a, b, c) rpl_waitpid(a, b, c) 32 | pid_t rpl_waitpid(pid_t, int *, int); 33 | 34 | #endif /* for sparse */ 35 | -------------------------------------------------------------------------------- /ofproto/automake.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc. 2 | # 3 | # Copying and distribution of this file, with or without modification, 4 | # are permitted in any medium without royalty provided the copyright 5 | # notice and this notice are preserved. This file is offered as-is, 6 | # without warranty of any kind. 7 | 8 | noinst_LIBRARIES += ofproto/libofproto.a 9 | ofproto_libofproto_a_SOURCES = \ 10 | ofproto/collectors.c \ 11 | ofproto/collectors.h \ 12 | ofproto/connmgr.c \ 13 | ofproto/connmgr.h \ 14 | ofproto/fail-open.c \ 15 | ofproto/fail-open.h \ 16 | ofproto/in-band.c \ 17 | ofproto/in-band.h \ 18 | ofproto/names.c \ 19 | ofproto/netflow.c \ 20 | ofproto/netflow.h \ 21 | ofproto/ofproto.c \ 22 | ofproto/ofproto.h \ 23 | ofproto/ofproto-dpif.c \ 24 | ofproto/ofproto-dpif-governor.c \ 25 | ofproto/ofproto-dpif-governor.h \ 26 | ofproto/ofproto-dpif-sflow.c \ 27 | ofproto/ofproto-dpif-sflow.h \ 28 | ofproto/ofproto-provider.h \ 29 | ofproto/pktbuf.c \ 30 | ofproto/pktbuf.h \ 31 | ofproto/pinsched.c \ 32 | ofproto/pinsched.h 33 | 34 | MAN_FRAGMENTS += ofproto/ofproto-unixctl.man ofproto/ofproto-dpif-unixctl.man 35 | -------------------------------------------------------------------------------- /lib/dirs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DIRS_H 18 | #define DIRS_H 1 19 | 20 | const char *ovs_sysconfdir(void); /* /usr/local/etc */ 21 | const char *ovs_pkgdatadir(void); /* /usr/local/share/openvswitch */ 22 | const char *ovs_rundir(void); /* /usr/local/var/run/openvswitch */ 23 | const char *ovs_logdir(void); /* /usr/local/var/log/openvswitch */ 24 | const char *ovs_dbdir(void); /* /usr/local/etc/openvswitch */ 25 | const char *ovs_bindir(void); /* /usr/local/bin */ 26 | 27 | #endif /* dirs.h */ 28 | -------------------------------------------------------------------------------- /vswitchd/vswitch.gv: -------------------------------------------------------------------------------- 1 | digraph Open_vSwitch { 2 | size="6.5,4"; 3 | margin="0"; 4 | node [shape=box]; 5 | edge [dir=none, arrowhead=none, arrowtail=none]; 6 | Bridge []; 7 | Bridge -> sFlow [label="sflow?"]; 8 | Bridge -> Mirror [label="mirrors*"]; 9 | Bridge -> Port [label="ports*"]; 10 | Bridge -> Controller [label="controller*"]; 11 | Bridge -> Flow_Table [label="flow_tables value*"]; 12 | Bridge -> NetFlow [label="netflow?"]; 13 | QoS [style=bold]; 14 | QoS -> Queue [label="queues value*"]; 15 | sFlow []; 16 | Open_vSwitch [style=bold]; 17 | Open_vSwitch -> Bridge [label="bridges*"]; 18 | Open_vSwitch -> SSL [label="ssl?"]; 19 | Open_vSwitch -> Manager [label="manager_options*"]; 20 | Controller []; 21 | Flow_Table []; 22 | Queue [style=bold]; 23 | SSL []; 24 | Manager []; 25 | Mirror []; 26 | Mirror -> Port [style=dotted, constraint=false, label="select_src_port*"]; 27 | Mirror -> Port [style=dotted, constraint=false, label="output_port?"]; 28 | Mirror -> Port [style=dotted, constraint=false, label="select_dst_port*"]; 29 | Interface []; 30 | NetFlow []; 31 | Port []; 32 | Port -> QoS [label="qos?"]; 33 | Port -> Interface [label="interfaces+"]; 34 | } 35 | -------------------------------------------------------------------------------- /lib/route-table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ROUTE_TABLE_H 18 | #define ROUTE_TABLE_H 1 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "openvswitch/types.h" 26 | 27 | bool route_table_get_ifindex(ovs_be32 ip, int *ifindex); 28 | bool route_table_get_name(ovs_be32 ip, char name[IFNAMSIZ]); 29 | void route_table_register(void); 30 | void route_table_unregister(void); 31 | void route_table_run(void); 32 | void route_table_wait(void); 33 | 34 | #endif /* route-table.h */ 35 | -------------------------------------------------------------------------------- /ofproto/collectors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef COLLECTORS_H 18 | #define COLLECTORS_H 1 19 | 20 | #include 21 | #include 22 | 23 | struct collectors; 24 | struct sset; 25 | 26 | int collectors_create(const struct sset *targets, uint16_t default_port, 27 | struct collectors **); 28 | void collectors_destroy(struct collectors *); 29 | 30 | void collectors_send(const struct collectors *, const void *, size_t); 31 | 32 | int collectors_count(const struct collectors *); 33 | 34 | #endif /* collectors.h */ 35 | -------------------------------------------------------------------------------- /tests/uuid.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([UUID unit tests]) 2 | 3 | m4_define([UUID_REGEX], 4 | [[[0-9a-f]\{8\}-[0-9a-f]\{4\}-4[0-9a-f]\{3\}-[89ab][0-9a-f]\{3\}-[0-9a-f]\{12\}$]]) 5 | 6 | m4_define([CHECK_UUID], 7 | [if expr "$uuid" : 'UUID_REGEX' > /dev/null 8 | then 9 | : 10 | else 11 | echo "$uuid: not a random UUID" 12 | exit 1 13 | fi]) 14 | 15 | AT_SETUP([UUID generation, parsing, serialization]) 16 | AT_KEYWORDS([UUID]) 17 | AT_CHECK([ 18 | uuids= 19 | for i in m4_for([count], [1], [100], [1], [count ]); do 20 | # Generate random UUID and check that it is in the expected format. 21 | uuid=`test-uuid` 22 | CHECK_UUID 23 | 24 | # Verify that $uuid does not duplicate any UUID generated so far. 25 | case $uuids in 26 | *$uuid*) 27 | echo "$uuid: generated duplicate UUID" 28 | exit 1 29 | esac 30 | uuids="$uuids $uuid" 31 | 32 | # Verify that test-uuid parses and re-serializes this UUID correctly. 33 | serialized=`test-uuid $uuid` 34 | if test "$uuid" != "$serialized"; then 35 | echo "$uuid: test-uuid serialized this as $serialized" 36 | exit 1 37 | fi 38 | done], [0]) 39 | AT_CLEANUP 40 | -------------------------------------------------------------------------------- /lib/netdev-linux.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NETDEV_LINUX_H 18 | #define NETDEV_LINUX_H 1 19 | 20 | #include 21 | #include 22 | 23 | /* These functions are Linux specific, so they should be used directly only by 24 | * Linux-specific code. */ 25 | 26 | struct netdev; 27 | struct netdev_stats; 28 | struct rtnl_link_stats; 29 | 30 | int netdev_linux_ethtool_set_flag(struct netdev *netdev, uint32_t flag, 31 | const char *flag_name, bool enable); 32 | int netdev_linux_get_af_inet_sock(void); 33 | 34 | #endif /* netdev-linux.h */ 35 | -------------------------------------------------------------------------------- /lib/netdev-vport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NETDEV_VPORT_H 18 | #define NETDEV_VPORT_H 1 19 | 20 | struct dpif_linux_vport; 21 | struct netdev; 22 | struct netdev_stats; 23 | 24 | void netdev_vport_register(void); 25 | 26 | const struct ofpbuf *netdev_vport_get_options(const struct netdev *); 27 | 28 | enum ovs_vport_type netdev_vport_get_vport_type(const struct netdev *); 29 | const char *netdev_vport_get_netdev_type(const struct dpif_linux_vport *); 30 | 31 | int netdev_vport_get_stats(const struct netdev *, struct netdev_stats *); 32 | 33 | #endif /* netdev-vport.h */ 34 | -------------------------------------------------------------------------------- /lib/route-table-stub.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. */ 14 | 15 | #include 16 | #include "route-table.h" 17 | 18 | #include "compiler.h" 19 | 20 | bool 21 | route_table_get_name(ovs_be32 ip OVS_UNUSED, char name[IFNAMSIZ] OVS_UNUSED) 22 | { 23 | name[0] = '\0'; 24 | return false; 25 | } 26 | 27 | bool 28 | route_table_get_ifindex(ovs_be32 ip OVS_UNUSED, int *ifindex) 29 | { 30 | *ifindex = 0; 31 | return false; 32 | } 33 | 34 | void 35 | route_table_register(void) 36 | { 37 | } 38 | 39 | void 40 | route_table_unregister(void) 41 | { 42 | } 43 | 44 | void 45 | route_table_run(void) 46 | { 47 | } 48 | -------------------------------------------------------------------------------- /lib/signals.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SIGNALS_H 18 | #define SIGNALS_H 1 19 | 20 | #include 21 | #include 22 | 23 | void signal_init(void); 24 | 25 | struct signal *signal_register(int signr); 26 | void signal_unregister(struct signal *); 27 | 28 | bool signal_poll(struct signal *); 29 | void signal_wait(struct signal *); 30 | 31 | const char *signal_name(int signum); 32 | 33 | void xsigaction(int signum, const struct sigaction *, struct sigaction *old); 34 | void xsigprocmask(int how, const sigset_t *, sigset_t *old); 35 | 36 | #endif /* signals.h */ 37 | -------------------------------------------------------------------------------- /tests/test-uuid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "uuid.h" 19 | #include 20 | 21 | int 22 | main(int argc, char *argv[]) 23 | { 24 | struct uuid uuid; 25 | 26 | if (argc == 1) { 27 | uuid_generate(&uuid); 28 | } else if (argc == 2) { 29 | if (!uuid_from_string(&uuid, argv[1])) { 30 | ovs_fatal(0, "\"%s\" is not a valid UUID", argv[1]); 31 | } 32 | } else { 33 | ovs_fatal(0, "usage: %s [UUID]", argv[0]); 34 | } 35 | 36 | printf(UUID_FMT"\n", UUID_ARGS(&uuid)); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/net.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_NET_WRAPPER_H 2 | #define __LINUX_NET_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef net_ratelimited_function 7 | #define net_ratelimited_function(function, ...) \ 8 | do { \ 9 | if (net_ratelimit()) \ 10 | function(__VA_ARGS__); \ 11 | } while (0) 12 | 13 | #define net_emerg_ratelimited(fmt, ...) \ 14 | net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__) 15 | #define net_alert_ratelimited(fmt, ...) \ 16 | net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__) 17 | #define net_crit_ratelimited(fmt, ...) \ 18 | net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__) 19 | #define net_err_ratelimited(fmt, ...) \ 20 | net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__) 21 | #define net_notice_ratelimited(fmt, ...) \ 22 | net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__) 23 | #define net_warn_ratelimited(fmt, ...) \ 24 | net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__) 25 | #define net_info_ratelimited(fmt, ...) \ 26 | net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__) 27 | #define net_dbg_ratelimited(fmt, ...) \ 28 | net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /tests/ovsdb-monitor-sort.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | # Breaks lines read from into groups using blank lines as 7 | # group separators, then sorts lines within the groups for 8 | # reproducibility. 9 | 10 | sub compare_lines { 11 | my ($a, $b) = @_; 12 | 13 | my $u = '[0-9a-fA-F]'; 14 | my $uuid_re = "${u}{8}-${u}{4}-${u}{4}-${u}{4}-${u}{12}"; 15 | if ($a =~ /^$uuid_re/) { 16 | if ($b =~ /^$uuid_re/) { 17 | return substr($a, 36) cmp substr($b, 36); 18 | } else { 19 | return 1; 20 | } 21 | } elsif ($b =~ /^$uuid_re/) { 22 | return -1; 23 | } else { 24 | return $a cmp $b; 25 | } 26 | } 27 | 28 | sub output_group { 29 | my (@group) = @_; 30 | print "$_\n" foreach sort { compare_lines($a, $b) } @group; 31 | } 32 | 33 | my @group = (); 34 | while () { 35 | chomp; 36 | if ($_ eq '') { 37 | output_group(@group); 38 | @group = (); 39 | print "\n"; 40 | } else { 41 | if (/^,/ && @group) { 42 | $group[$#group] .= "\n" . $_; 43 | } else { 44 | push(@group, $_); 45 | } 46 | } 47 | } 48 | 49 | output_group(@group) if @group; 50 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/reciprocal_div.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_RECIPROCAL_DIV_WRAPPER_H 2 | #define __LINUX_RECIPROCAL_DIV_WRAPPER_H 3 | 4 | #include 5 | 6 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 7 | #include_next 8 | #else 9 | 10 | #include 11 | 12 | /* 13 | * This file describes reciprocical division. 14 | * 15 | * This optimizes the (A/B) problem, when A and B are two u32 16 | * and B is a known value (but not known at compile time) 17 | * 18 | * The math principle used is : 19 | * Let RECIPROCAL_VALUE(B) be (((1LL << 32) + (B - 1))/ B) 20 | * Then A / B = (u32)(((u64)(A) * (R)) >> 32) 21 | * 22 | * This replaces a divide by a multiply (and a shift), and 23 | * is generally less expensive in CPU cycles. 24 | */ 25 | 26 | /* 27 | * Computes the reciprocal value (R) for the value B of the divisor. 28 | * Should not be called before each reciprocal_divide(), 29 | * or else the performance is slower than a normal divide. 30 | */ 31 | extern u32 reciprocal_value(u32 B); 32 | 33 | 34 | static inline u32 reciprocal_divide(u32 A, u32 R) 35 | { 36 | return (u32)(((u64)A * R) >> 32); 37 | } 38 | 39 | #endif /* Linux kernel < 2.6.20 */ 40 | #endif /* __LINUX_RECIPROCAL_DIV_WRAPPER_H */ 41 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/ovsdbmonitor.in: -------------------------------------------------------------------------------- 1 | #! @PYTHON@ 2 | # Copyright (c) 2010 Citrix Systems, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Version 1.51 17 | # 2010-05-07 18 | 19 | import sys 20 | sys.path.insert(0, "@ovsdbmonitordir@") 21 | sys.path.insert(0, "@abs_top_srcdir@/ovsdb/ovsdbmonitor") # NOINSTALL 22 | 23 | import sys, traceback 24 | from pprint import pprint 25 | from OVEApp import * 26 | 27 | app = OVEApp() 28 | try: 29 | retVal = app.enter() 30 | except Exception, e: 31 | print str(e) 32 | try: 33 | trace = traceback.format_tb(sys.exc_info()[2]) 34 | except: 35 | trace = ['Traceback not available'] 36 | print("".join(trace)) 37 | retVal = 1 38 | 39 | sys.exit(retVal) 40 | -------------------------------------------------------------------------------- /ofproto/names.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "ofproto/ofproto.h" 20 | 21 | #include "dpif.h" 22 | 23 | /* This function is in a separate file because it is the only ofproto function 24 | * required by ovs-ofctl, which allows ovs-ofctl to avoid linking in extra 25 | * baggage. */ 26 | 27 | /* Parses 'ofproto_name', which is of the form [type@]name into component 28 | * pieces that are suitable for passing to ofproto_create(). The caller must 29 | * free 'name' and 'type'. */ 30 | void 31 | ofproto_parse_name(const char *ofproto_name, char **name, char **type) 32 | { 33 | dp_parse_name(ofproto_name, name, type); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /python/ovs/db/error.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2009, 2010, 2011 Nicira, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import ovs.json 16 | 17 | 18 | class Error(Exception): 19 | def __init__(self, msg, json=None, tag=None): 20 | self.msg = msg 21 | self.json = json 22 | if tag is None: 23 | if json is None: 24 | self.tag = "ovsdb error" 25 | else: 26 | self.tag = "syntax error" 27 | else: 28 | self.tag = tag 29 | 30 | # Compose message. 31 | syntax = "" 32 | if self.json is not None: 33 | syntax = 'syntax "%s": ' % ovs.json.to_string(self.json) 34 | Exception.__init__(self, "%s%s: %s" % (syntax, self.tag, self.msg)) 35 | -------------------------------------------------------------------------------- /lib/aes128.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Based on rijndael.txt by Philip J. Erdelsky, downloaded from 19 | * http://www.efgh.com/software/rijndael.htm on September 24, 2009. The 20 | * license information there is: "Public domain; no restrictions on use." 21 | * The Apache license above applies only to Nicira's modifications to the 22 | * original code. 23 | */ 24 | 25 | #ifndef AES128_H 26 | #define AES128_H 27 | 28 | #include 29 | 30 | struct aes128 { 31 | uint32_t rk[128/8 + 28]; 32 | }; 33 | 34 | void aes128_schedule(struct aes128 *, const uint8_t key[16]); 35 | void aes128_encrypt(const struct aes128 *, const void *, void *); 36 | 37 | #endif /* aes128.h */ 38 | -------------------------------------------------------------------------------- /lib/ssl.man: -------------------------------------------------------------------------------- 1 | .de IQ 2 | . br 3 | . ns 4 | . IP "\\$1" 5 | .. 6 | .IP "\fB\-p\fR \fIprivkey.pem\fR" 7 | .IQ "\fB\-\-private\-key=\fIprivkey.pem\fR" 8 | Specifies a PEM file containing the private key used as \fB\*(PN\fR's 9 | identity for outgoing SSL connections. 10 | . 11 | .IP "\fB\-c\fR \fIcert.pem\fR" 12 | .IQ "\fB\-\-certificate=\fIcert.pem\fR" 13 | Specifies a PEM file containing a certificate that certifies the 14 | private key specified on \fB\-p\fR or \fB\-\-private\-key\fR to be 15 | trustworthy. The certificate must be signed by the certificate 16 | authority (CA) that the peer in SSL connections will use to verify it. 17 | . 18 | .IP "\fB\-C\fR \fIcacert.pem\fR" 19 | .IQ "\fB\-\-ca\-cert=\fIcacert.pem\fR" 20 | Specifies a PEM file containing the CA certificate that \fB\*(PN\fR 21 | should use to verify certificates presented to it by SSL peers. (This 22 | may be the same certificate that SSL peers use to verify the 23 | certificate specified on \fB\-c\fR or \fB\-\-certificate\fR, or it may 24 | be a different one, depending on the PKI design in use.) 25 | . 26 | .IP "\fB\-C none\fR" 27 | .IQ "\fB\-\-ca\-cert=none\fR" 28 | Disables verification of certificates presented by SSL peers. This 29 | introduces a security risk, because it means that certificates cannot 30 | be verified to be those of known trusted hosts. 31 | -------------------------------------------------------------------------------- /debian/openvswitch-controller.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postrm script for openvswitch-controller 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # 18 | # for details, see http://www.debian.org/doc/debian-policy/ or 19 | # the debian-policy package 20 | 21 | 22 | case "$1" in 23 | purge) 24 | if cd /etc/openvswitch-controller; then 25 | rm -f cacert.pem cert.pem privkey.pem req.pem 26 | rm -f tmp-privkey.pem tmp-cert.pem tmp-req.pem 27 | fi 28 | ;; 29 | 30 | remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 31 | ;; 32 | 33 | *) 34 | echo "postrm called with unknown argument \`$1'" >&2 35 | exit 1 36 | ;; 37 | esac 38 | 39 | # dh_installdeb will replace this with shell code automatically 40 | # generated by other debhelper scripts. 41 | 42 | #DEBHELPER# 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /lib/timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "timer.h" 20 | 21 | #include "poll-loop.h" 22 | #include "timeval.h" 23 | 24 | /* Returns the number of milliseconds until 'timer' expires. */ 25 | long long int 26 | timer_msecs_until_expired(const struct timer *timer) 27 | { 28 | switch (timer->t) { 29 | case LLONG_MAX: return LLONG_MAX; 30 | case LLONG_MIN: return 0; 31 | default: return timer->t - time_msec(); 32 | } 33 | } 34 | 35 | /* Causes poll_block() to wake when 'timer' expires. */ 36 | void 37 | (timer_wait)(const struct timer *timer, const char *where) 38 | { 39 | if (timer->t < LLONG_MAX) { 40 | (poll_timer_wait_until)(timer->t, where); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/csum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef CSUM_H 18 | #define CSUM_H 1 19 | 20 | #include 21 | #include 22 | #include "openvswitch/types.h" 23 | 24 | ovs_be16 csum(const void *, size_t); 25 | uint32_t csum_add16(uint32_t partial, ovs_be16); 26 | uint32_t csum_add32(uint32_t partial, ovs_be32); 27 | uint32_t csum_continue(uint32_t partial, const void *, size_t); 28 | ovs_be16 csum_finish(uint32_t partial); 29 | ovs_be16 recalc_csum16(ovs_be16 old_csum, ovs_be16 old_u16, ovs_be16 new_u16); 30 | ovs_be16 recalc_csum32(ovs_be16 old_csum, ovs_be32 old_u32, ovs_be32 new_u32); 31 | ovs_be16 recalc_csum128(ovs_be16 old_csum, ovs_be32 old_u32[4], 32 | const ovs_be32 new_u32[4]); 33 | 34 | #endif /* csum.h */ 35 | -------------------------------------------------------------------------------- /third-party/README: -------------------------------------------------------------------------------- 1 | This directory contains third-party software that may be useful for 2 | debugging. 3 | 4 | tcpdump 5 | ------- 6 | The "ofp-tcpdump.patch" patch adds the ability to parse OpenFlow 7 | messages to tcpdump. These instructions assume that tcpdump 4.3.0 8 | is going to be used, but it should work with other versions that are not 9 | substantially different. To begin, download tcpdump and apply the 10 | patch: 11 | 12 | wget http://www.tcpdump.org/release/tcpdump-4.3.0.tar.gz 13 | tar xzf tcpdump-4.3.0.tar.gz 14 | ln -s tcpdump-4.3.0 tcpdump 15 | patch -p0 < ofp-tcpdump.patch 16 | 17 | Then build the new version of tcpdump: 18 | 19 | cd tcpdump 20 | ./configure 21 | make 22 | 23 | Clearly, tcpdump can only parse unencrypted packets, so you will need to 24 | connect the controller and datapath using plain TCP. To look at the 25 | traffic, tcpdump will be started in a manner similar to the following: 26 | 27 | sudo ./tcpdump -s0 -i eth0 port 6633 28 | 29 | The "-s0" flag indicates that tcpdump should capture the entire packet. 30 | If the OpenFlow message is not received in its entirety, "[|openflow]" will 31 | be printed instead of the OpenFlow message contents. 32 | 33 | The verbosity of the output may be increased by adding additional "-v" 34 | flags. If "-vvv" is used, the raw OpenFlow data is also printed in 35 | hex and ASCII. 36 | -------------------------------------------------------------------------------- /lib/stream-fd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STREAM_FD_H 18 | #define STREAM_FD_H 1 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | struct stream; 25 | struct pstream; 26 | struct sockaddr; 27 | 28 | int new_fd_stream(const char *name, int fd, int connect_status, 29 | struct stream **streamp); 30 | int new_fd_pstream(const char *name, int fd, 31 | int (*accept_cb)(int fd, const struct sockaddr *, 32 | size_t sa_len, struct stream **), 33 | int (*set_dscp_cb)(int fd, uint8_t dscp), 34 | char *unlink_path, 35 | struct pstream **pstreamp); 36 | 37 | #endif /* stream-fd.h */ 38 | -------------------------------------------------------------------------------- /debian/openvswitch-pki.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postrm script for openvswitch-pki 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # 18 | # for details, see http://www.debian.org/doc/debian-policy/ or 19 | # the debian-policy package 20 | 21 | 22 | case "$1" in 23 | purge) 24 | rm -f /var/log/openvswitch/ovs-pki.log* || true 25 | 26 | # Remove backward compatibility symlink, if present. 27 | if test -h /usr/share/openvswitch/pki; then 28 | rm -f /usr/share/openvswitch/pki 29 | fi 30 | ;; 31 | 32 | remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 33 | ;; 34 | 35 | *) 36 | echo "postrm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | # dh_installdeb will replace this with shell code automatically 42 | # generated by other debhelper scripts. 43 | 44 | #DEBHELPER# 45 | 46 | exit 0 47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STRING_WRAPPER_H 18 | #define STRING_WRAPPER_H 1 19 | 20 | #include_next 21 | 22 | /* Glibc 2.7 has a bug in strtok_r when compiling with optimization that can 23 | * cause segfaults if the delimiters argument is a compile-time constant that 24 | * has exactly 1 character: 25 | * 26 | * http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614 27 | * 28 | * The bug is only present in the inline version of strtok_r(), so force the 29 | * out-of-line version to be used instead. */ 30 | #if HAVE_STRTOK_R_BUG 31 | #undef strtok_r 32 | #endif 33 | 34 | #ifndef HAVE_STRNLEN 35 | #undef strnlen 36 | #define strnlen rpl_strnlen 37 | size_t strnlen(const char *, size_t maxlen); 38 | #endif 39 | 40 | #endif /* string.h wrapper */ 41 | -------------------------------------------------------------------------------- /lib/command-line.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef COMMAND_LINE_H 18 | #define COMMAND_LINE_H 1 19 | 20 | /* Utilities for command-line parsing. */ 21 | 22 | #include "compiler.h" 23 | 24 | struct option; 25 | 26 | struct command { 27 | const char *name; 28 | int min_args; 29 | int max_args; 30 | void (*handler)(int argc, char *argv[]); 31 | }; 32 | 33 | char *long_options_to_short_options(const struct option *options); 34 | void run_command(int argc, char *argv[], const struct command[]); 35 | 36 | void proctitle_init(int argc, char **argv); 37 | #ifdef __FreeBSD__ 38 | #define proctitle_set setproctitle 39 | #else 40 | void proctitle_set(const char *, ...) 41 | PRINTF_FORMAT(1, 2); 42 | #endif 43 | void proctitle_restore(void); 44 | 45 | #endif /* command-line.h */ 46 | -------------------------------------------------------------------------------- /datapath/Modules.mk: -------------------------------------------------------------------------------- 1 | # Some modules should be built and distributed, e.g. openvswitch. 2 | # 3 | # Some modules should be built but not distributed, e.g. third-party 4 | # hwtable modules. 5 | both_modules = openvswitch 6 | build_modules = $(both_modules) # Modules to build 7 | dist_modules = $(both_modules) # Modules to distribute 8 | 9 | openvswitch_sources = \ 10 | actions.c \ 11 | checksum.c \ 12 | datapath.c \ 13 | dp_notify.c \ 14 | flow.c \ 15 | genl_exec.c \ 16 | tunnel.c \ 17 | vlan.c \ 18 | vport.c \ 19 | vport-capwap.c \ 20 | vport-gre.c \ 21 | vport-internal_dev.c \ 22 | vport-netdev.c \ 23 | vport-patch.c \ 24 | vport-vxlan.c 25 | 26 | openvswitch_headers = \ 27 | checksum.h \ 28 | compat.h \ 29 | datapath.h \ 30 | flow.h \ 31 | genl_exec.h \ 32 | tunnel.h \ 33 | vlan.h \ 34 | vport.h \ 35 | vport-capwap.h \ 36 | vport-internal_dev.h \ 37 | vport-netdev.h 38 | 39 | openvswitch_extras = \ 40 | README \ 41 | CAPWAP.txt 42 | 43 | dist_sources = $(foreach module,$(dist_modules),$($(module)_sources)) 44 | dist_headers = $(foreach module,$(dist_modules),$($(module)_headers)) 45 | dist_extras = $(foreach module,$(dist_modules),$($(module)_extras)) 46 | build_sources = $(foreach module,$(build_modules),$($(module)_sources)) 47 | build_headers = $(foreach module,$(build_modules),$($(module)_headers)) 48 | build_links = $(notdir $(build_sources)) 49 | build_objects = $(notdir $(patsubst %.c,%.o,$(build_sources))) 50 | -------------------------------------------------------------------------------- /tests/test-strtok_r.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /* Some versions of glibc 2.7 has a bug in strtok_r when with optimization that 22 | * can cause segfaults: 23 | * http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614. 24 | * 25 | * Open vSwitch works around this problem by supplying a replacement string.h. 26 | * This test program verifies that the workaround is in place. 27 | */ 28 | int 29 | main(void) 30 | { 31 | char string[] = ":::"; 32 | char *save_ptr = (char *) 0xc0ffee; 33 | char *token1, *token2; 34 | token1 = strtok_r(string, ":", &save_ptr); 35 | token2 = strtok_r(NULL, ":", &save_ptr); 36 | printf ("%s %s\n", token1 ? token1 : "NULL", token2 ? token2 : "NULL"); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/net/checksum.h: -------------------------------------------------------------------------------- 1 | #ifndef __NET_CHECKSUM_WRAPPER_H 2 | #define __NET_CHECKSUM_WRAPPER_H 1 3 | 4 | #include_next 5 | 6 | #ifndef HAVE_CSUM_UNFOLD 7 | static inline __wsum csum_unfold(__sum16 n) 8 | { 9 | return (__force __wsum)n; 10 | } 11 | #endif /* !HAVE_CSUM_UNFOLD */ 12 | 13 | /* Workaround for debugging included in certain versions of XenServer. It only 14 | * applies to 32-bit x86. 15 | */ 16 | #if defined(HAVE_CSUM_COPY_DBG) && defined(CONFIG_X86_32) 17 | #define csum_and_copy_to_user(src, dst, len, sum, err_ptr) \ 18 | csum_and_copy_to_user(src, dst, len, sum, NULL, err_ptr) 19 | #endif 20 | 21 | #ifndef HAVE_CSUM_REPLACE4 22 | static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) 23 | { 24 | __be32 diff[] = { ~from, to }; 25 | 26 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); 27 | } 28 | 29 | static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 30 | { 31 | csum_replace4(sum, (__force __be32)from, (__force __be32)to); 32 | } 33 | #endif 34 | 35 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) 36 | #define inet_proto_csum_replace2(sum, skb, from, to, pseudohdr) \ 37 | inet_proto_csum_replace4(sum, skb, (__force __be32)(from), \ 38 | (__force __be32)(to), pseudohdr) 39 | #endif 40 | 41 | #ifndef CSUM_MANGLED_0 42 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) 43 | #endif 44 | 45 | #endif /* checksum.h */ 46 | -------------------------------------------------------------------------------- /ofproto/pktbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PKTBUF_H 18 | #define PKTBUF_H 1 19 | 20 | #include 21 | #include 22 | 23 | #include "ofp-errors.h" 24 | 25 | struct pktbuf; 26 | struct ofpbuf; 27 | 28 | int pktbuf_capacity(void); 29 | 30 | struct pktbuf *pktbuf_create(void); 31 | void pktbuf_destroy(struct pktbuf *); 32 | uint32_t pktbuf_save(struct pktbuf *, const void *buffer, size_t buffer_size, 33 | uint16_t in_port); 34 | uint32_t pktbuf_get_null(void); 35 | enum ofperr pktbuf_retrieve(struct pktbuf *, uint32_t id, 36 | struct ofpbuf **bufferp, uint16_t *in_port); 37 | void pktbuf_discard(struct pktbuf *, uint32_t id); 38 | 39 | unsigned int pktbuf_count_packets(const struct pktbuf *); 40 | 41 | #endif /* pktbuf.h */ 42 | -------------------------------------------------------------------------------- /xenserver/etc_profile.d_openvswitch.sh: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009, 2010, 2011 Nicira, Inc. 2 | # 3 | # Copying and distribution of this file, with or without modification, 4 | # are permitted in any medium without royalty provided the copyright 5 | # notice and this notice are preserved. This file is offered as-is, 6 | # without warranty of any kind. 7 | 8 | alias vswitch='service openvswitch' 9 | alias openvswitch='service openvswitch' 10 | 11 | function watchdp { 12 | watch ovs-dpctl show "$@" 13 | } 14 | 15 | function watchdpflows { 16 | local grep="" 17 | local dp=$1 18 | shift 19 | if [ $# -gt 0 ]; then 20 | grep="| grep $@" 21 | fi 22 | watch "ovs-dpctl dump-flows $dp $grep" 23 | } 24 | 25 | function watchflows { 26 | local grep="" 27 | local dp=$1 28 | shift 29 | bridge=$(ovs-dpctl show $dp | grep 'port 0:' | cut -d' ' -f 3) 30 | if [ $# -gt 0 ]; then 31 | grep="| grep $@" 32 | fi 33 | watch "ovs-ofctl dump-flows unix:/var/run/$bridge.mgmt $grep" 34 | } 35 | 36 | function monitorlogs { 37 | local grep="" 38 | if [ $# -gt 0 ]; then 39 | grep="| grep --line-buffered '^==> .* <==$" 40 | for i in "$@"; do 41 | grep="$grep\|$i" 42 | done 43 | grep="$grep'" 44 | fi 45 | cmd="tail -F /var/log/messages /var/log/openvswitch/ovs-vswitchd.log /var/log/openvswitch/ovsdb-server /var/log/xensource.log $grep | tee /var/log/monitorlogs.out" 46 | printf "cmd: $cmd\n" 47 | eval "$cmd" 48 | } 49 | -------------------------------------------------------------------------------- /lib/dummy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "dummy.h" 20 | 21 | /* Enables support for "dummy" network devices and dpifs, which are useful for 22 | * testing. A client program might call this function if it is designed 23 | * specifically for testing or the user enables it on the command line. 24 | * 25 | * If 'override' is false, then "dummy" dpif and netdev classes will be 26 | * created. If 'override' is true, then in addition all existing dpif and 27 | * netdev classes will be deleted and replaced by dummy classes. 28 | * 29 | * There is no strong reason why dummy devices shouldn't always be enabled. */ 30 | void 31 | dummy_enable(bool override) 32 | { 33 | netdev_dummy_register(override); 34 | dpif_dummy_register(override); 35 | timeval_dummy_register(); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ovsdb/query.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009 Nicira, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #ifndef OVSDB_QUERY_H 17 | #define OVSDB_QUERY_H 1 18 | 19 | #include 20 | 21 | struct ovsdb_column_set; 22 | struct ovsdb_condition; 23 | struct ovsdb_row; 24 | struct ovsdb_row_set; 25 | struct ovsdb_table; 26 | struct ovsdb_txn; 27 | 28 | void ovsdb_query(struct ovsdb_table *, const struct ovsdb_condition *, 29 | bool (*output_row)(const struct ovsdb_row *, void *aux), 30 | void *aux); 31 | void ovsdb_query_row_set(struct ovsdb_table *, const struct ovsdb_condition *, 32 | struct ovsdb_row_set *); 33 | void ovsdb_query_distinct(struct ovsdb_table *, const struct ovsdb_condition *, 34 | const struct ovsdb_column_set *, 35 | struct ovsdb_row_set *); 36 | 37 | #endif /* ovsdb/query.h */ 38 | -------------------------------------------------------------------------------- /tests/autopath.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([autopath link selection]) 2 | 3 | AT_SETUP([autopath basic]) 4 | AT_CHECK([ovs-ofctl parse-flow 'actions=autopath(1, NXM_NX_REG0[[]])'], [0], 5 | [usable protocols: any 6 | chosen protocol: OpenFlow10-table_id 7 | OFPT_FLOW_MOD (xid=0x1): ADD actions=autopath(1,NXM_NX_REG0[[]]) 8 | ], [stderr]) 9 | AT_CHECK([ovs-ofctl parse-flow 'actions=autopath(2, NXM_NX_REG0[[2..30]])'], [0], 10 | [usable protocols: any 11 | chosen protocol: OpenFlow10-table_id 12 | OFPT_FLOW_MOD (xid=0x1): ADD actions=autopath(2,NXM_NX_REG0[[2..30]]) 13 | ], [stderr]) 14 | AT_CHECK([[sed 's/^[^|]*|[^|]*|//' stderr]], [0], [dnl 15 | autopath|WARN|The autopath action is deprecated and may be removed in February 2013. Please email dev@openvswitch.org with concerns. 16 | ]) 17 | AT_CLEANUP 18 | 19 | AT_SETUP([autopath action missing argument]) 20 | AT_CHECK([ovs-ofctl parse-flow actions=autopath], [1], [], 21 | [ovs-ofctl: : not enough arguments to autopath action 22 | ]) 23 | AT_CLEANUP 24 | 25 | AT_SETUP([autopath action bad port]) 26 | AT_CHECK([ovs-ofctl parse-flow 'actions=autopath(bad, NXM_NX_REG0[[]])'], [1], [], 27 | [ovs-ofctl: bad, NXM_NX_REG0[[]]: bad port number 28 | ]) 29 | AT_CLEANUP 30 | 31 | AT_SETUP([autopath action destination too narrow]) 32 | AT_CHECK([ovs-ofctl parse-flow 'actions=autopath(1,NXM_NX_REG0[[0..7]])'], [1], [], 33 | [ovs-ofctl: 1,NXM_NX_REG0[[0..7]]: 8-bit destination field has 256 possible values, less than required 65536 34 | ]) 35 | AT_CLEANUP 36 | 37 | -------------------------------------------------------------------------------- /debian/openvswitch-switch.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postrm script for openvswitch-switch 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # 18 | # for details, see http://www.debian.org/doc/debian-policy/ or 19 | # the debian-policy package 20 | 21 | 22 | case "$1" in 23 | purge) 24 | rm -f /etc/openvswitch/conf.db 25 | rm -f /etc/openvswitch/.conf.db.~lock~ 26 | rm -f /etc/default/openvswitch-switch 27 | rm -f /var/log/openvswitch/ovs-vswitchd.log* || true 28 | rm -f /var/log/openvswitch/ovsdb-server.log* || true 29 | rm -f /etc/openvswitch/system-id.conf 30 | ;; 31 | 32 | remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 33 | ;; 34 | 35 | *) 36 | echo "postrm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | # dh_installdeb will replace this with shell code automatically 42 | # generated by other debhelper scripts. 43 | 44 | #DEBHELPER# 45 | 46 | exit 0 47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/autopath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef AUTOPATH_H 18 | #define AUTOPATH_H 1 19 | 20 | #include 21 | #include "ofp-errors.h" 22 | 23 | struct flow; 24 | struct nx_action_autopath; 25 | struct ofpact_autopath; 26 | struct ofpbuf; 27 | 28 | /* NXAST_AUTOPATH helper functions. 29 | * 30 | * See include/openflow/nicira-ext.h for NXAST_AUTOPATH specification. */ 31 | 32 | void autopath_parse(struct ofpact_autopath *, const char *); 33 | 34 | enum ofperr autopath_from_openflow(const struct nx_action_autopath *, 35 | struct ofpact_autopath *); 36 | enum ofperr autopath_check(const struct ofpact_autopath *, 37 | const struct flow *); 38 | void autopath_to_nxast(const struct ofpact_autopath *, 39 | struct ofpbuf *openflow); 40 | 41 | #endif /* autopath.h */ 42 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/OVEStandard.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Nicira, Inc. 2 | # Copyright (c) 2010 Citrix Systems, Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import os, re, struct, sys, time, types, uuid 17 | from copy import deepcopy 18 | from pprint import pprint 19 | 20 | # Set globalForcePySide to True to use PySide instead of PyQt if both are installed 21 | globalForcePySide = False 22 | 23 | try: 24 | import ovs.json 25 | except Exception, e: 26 | print('+++ OVS JSON module is required\n') 27 | raise 28 | 29 | try: 30 | if globalForcePySide: 31 | print('Forcing use of PySide') 32 | raise Exception() 33 | from PyQt4.QtCore import Qt, QVariant 34 | from PyQt4 import QtCore, QtGui 35 | except: 36 | try: 37 | from PySide.QtCore import Qt, QVariant 38 | from PySide import QtCore, QtGui 39 | except Exception, e: 40 | print('+++ This application requires either PyQt4 or PySide\n') 41 | raise 42 | 43 | -------------------------------------------------------------------------------- /ofproto/pinsched.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PINSCHED_H 18 | #define PINSCHED_H_H 1 19 | 20 | #include 21 | 22 | struct ofpbuf; 23 | 24 | typedef void pinsched_tx_cb(struct ofpbuf *, void *aux); 25 | struct pinsched *pinsched_create(int rate_limit, int burst_limit); 26 | void pinsched_get_limits(const struct pinsched *, 27 | int *rate_limit, int *burst_limit); 28 | void pinsched_set_limits(struct pinsched *, int rate_limit, int burst_limit); 29 | void pinsched_destroy(struct pinsched *); 30 | void pinsched_send(struct pinsched *, uint16_t port_no, struct ofpbuf *, 31 | pinsched_tx_cb *, void *aux); 32 | void pinsched_run(struct pinsched *, pinsched_tx_cb *, void *aux); 33 | void pinsched_wait(struct pinsched *); 34 | 35 | unsigned int pinsched_count_txqlen(const struct pinsched *); 36 | 37 | #endif /* pinsched.h */ 38 | -------------------------------------------------------------------------------- /tests/check-structs.at: -------------------------------------------------------------------------------- 1 | AT_BANNER([struct alignment checker unit tests]) 2 | 3 | m4_define([check_structs], [$top_srcdir/build-aux/check-structs]) 4 | m4_define([RUN_STRUCT_CHECKER], 5 | [AT_KEYWORDS([check-structs]) 6 | AT_SKIP_IF([test $HAVE_PYTHON = no]) 7 | AT_DATA([test.h], [$1 8 | ]) 9 | AT_CHECK_UNQUOTED([$PYTHON check_structs test.h], [$2], [$3], [$4])]) 10 | 11 | AT_SETUP([check struct tail padding]) 12 | RUN_STRUCT_CHECKER( 13 | [struct xyz { 14 | ovs_be16 x; 15 | };], 16 | [1], [], 17 | [test.h:3: warning: struct xyz needs 2 bytes of tail padding 18 | ]) 19 | AT_CLEANUP 20 | 21 | AT_SETUP([check struct internal alignment]) 22 | RUN_STRUCT_CHECKER( 23 | [struct xyzzy { 24 | ovs_be16 x; 25 | ovs_be32 y; 26 | };], 27 | [1], [], 28 | [test.h:3: warning: struct xyzzy member y is 2 bytes short of 4-byte alignment 29 | ]) 30 | AT_CLEANUP 31 | 32 | AT_SETUP([check struct declared size]) 33 | RUN_STRUCT_CHECKER( 34 | [struct wibble { 35 | ovs_be64 z; 36 | }; 37 | OFP_ASSERT(sizeof(struct wibble) == 12); 38 | ], 39 | [1], [], 40 | [test.h:4: warning: struct wibble is 8 bytes long but declared as 12 41 | ]) 42 | AT_CLEANUP 43 | 44 | AT_SETUP([check wrong struct's declared size]) 45 | RUN_STRUCT_CHECKER( 46 | [struct moo { 47 | ovs_be64 bar; 48 | }; 49 | OFP_ASSERT(sizeof(struct moo) == 8); 50 | struct wibble { 51 | ovs_be64 z; 52 | }; 53 | OFP_ASSERT(sizeof(struct moo) == 8); 54 | ], [1], [], [test.h:8: warning: checking size of struct moo but struct wibble was most recently defined 55 | ]) 56 | AT_CLEANUP 57 | -------------------------------------------------------------------------------- /ofproto/ofproto-dpif-unixctl.man: -------------------------------------------------------------------------------- 1 | .SS "DATAPATH COMMANDS" 2 | These commands manage logical datapaths. They are are similar to the 3 | equivalent \fBovs\-dpctl\fR commands. 4 | . 5 | .IP "\fBdpif/dump\-dps\fR" 6 | Prints the name of each configured datapath on a separate line. 7 | . 8 | .IP "\fBdpif/show\fR [\fIdp\fR...]" 9 | Prints a summary of configured datapaths, including statistics and a 10 | list of connected ports. The port information includes the OpenFlow 11 | port number, datapath port number, and the type. (The local port is 12 | identified as OpenFlow port 65534.) 13 | .IP 14 | If one or more datapaths are specified, information on only those 15 | datapaths are displayed. Otherwise, information about all configured 16 | datapaths are shown. 17 | . 18 | .IP "\fBdpif/dump\-flows \fIdp\fR" 19 | Prints to the console all flow entries in datapath \fIdp\fR's 20 | flow table. 21 | .IP 22 | This command is primarily useful for debugging Open vSwitch. The flow 23 | table entries that it displays are not OpenFlow flow entries. Instead, 24 | they are different and considerably simpler flows maintained by the 25 | datapath module. If you wish to see the OpenFlow flow entries, use 26 | \fBovs\-ofctl dump\-flows\fR. 27 | . 28 | .IP "\fBdpif/del\-flows \fIdp\fR" 29 | Deletes all flow entries from datapath \fIdp\fR's flow table and 30 | underlying datapath implementation (e.g., kernel datapath module). 31 | .IP 32 | This command is primarily useful for debugging Open vSwitch. As 33 | discussed in \fBdpif/dump\-flows\fR, these entries are 34 | not OpenFlow flow entries. 35 | -------------------------------------------------------------------------------- /utilities/ovs-parse-leaks.8: -------------------------------------------------------------------------------- 1 | .TH ovs\-parse\-leaks 8 "August 2010" "Open vSwitch" "Open vSwitch Manual" 2 | . 3 | .SH NAME 4 | ovs\-parse\-leaks \- parses OVS leak checker log files 5 | . 6 | .SH SYNOPSIS 7 | \fBovs\-parse\-leaks\fR [\fIbinary\fR] \fB< \fIlog\fR 8 | . 9 | .SH DESCRIPTION 10 | Many Open vSwitch daemons accept a \fB\-\-check\-leaks\fR option that 11 | writes information about memory allocation and deallocation to a log 12 | file. \fBovs\-parse\-leaks\fR parses log files produced by this 13 | option and prints a summary of the results. The most interesting part 14 | of the output is a list of memory blocks that were allocated but not 15 | freed, which Open vSwitch developers can use to find and fix memory 16 | leaks. 17 | .PP 18 | The log file must be supplied on standard input. The binary that 19 | produced the output should be supplied as the sole non-option 20 | argument. For best results, the binary should have debug symbols. 21 | . 22 | .SH OPTIONS 23 | .TP 24 | \fB\-\-help\fR 25 | Prints a usage message and exits. 26 | .SH BUGS 27 | The output can be hard to interpret, especially for a daemon that does 28 | not exit in normal operation. Using \fBovs\-appctl\fR(8) to invoke 29 | the \fBexit\fR command that some Open vSwitch daemons support 30 | sometimes helps with this. 31 | .PP 32 | \fBovs\-parse\-leaks\fR usually incorrectly reports one or more ``bad 33 | frees of not-allocated address'' errors at the beginning of output. 34 | These reflect frees of data that were allocated before the leak 35 | checker was turned on during program initialization. 36 | -------------------------------------------------------------------------------- /ovsdb/ovsdbmonitor/OVELogger.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Citrix Systems, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from OVEStandard import * 16 | 17 | class OVELogger(QtCore.QObject): 18 | instance = None 19 | def __init__(self): 20 | QtCore.QObject.__init__(self) 21 | self.contents = [] 22 | self.loggers = [] 23 | 24 | @classmethod 25 | def Inst(cls): 26 | if cls.instance is None: 27 | cls.instance = OVELogger() 28 | return cls.instance 29 | 30 | def reset(self): 31 | self.contents = [] 32 | self.update() 33 | 34 | def logString(self, message): 35 | self.contents += [str(message)] 36 | if len(self.contents) > 500: 37 | self.contents = ['+++ Log truncated', ''] + self.contents[50:] 38 | self.update() 39 | 40 | def update(self): 41 | self.emit(QtCore.SIGNAL("logUpdated()")) 42 | 43 | def OVELog(message): 44 | OVELogger.Inst().logString(message) 45 | 46 | -------------------------------------------------------------------------------- /rhel/etc_sysconfig_network-scripts_ifdown-ovs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2011 Alexey I. Froloff. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at: 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | . /etc/init.d/functions 18 | 19 | cd /etc/sysconfig/network-scripts 20 | . ./network-functions 21 | 22 | [ -f ../network ] && . ../network 23 | 24 | CONFIG=${1} 25 | TIMEOUT=10 26 | 27 | source_config 28 | 29 | . /etc/sysconfig/network 30 | 31 | OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${REAL_DEVICETYPE}" 32 | 33 | if [ ! -x ${OTHERSCRIPT} ]; then 34 | OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth" 35 | fi 36 | 37 | case "$TYPE" in 38 | OVSBridge) 39 | ${OTHERSCRIPT} ${CONFIG} $2 40 | retval=$? 41 | ovs-vsctl -t ${TIMEOUT} -- --if-exists del-br "$DEVICE" 42 | ;; 43 | OVSPort|OVSIntPort|OVSBond) 44 | ${OTHERSCRIPT} ${CONFIG} $2 45 | retval=$? 46 | ovs-vsctl -t ${TIMEOUT} -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" 47 | ;; 48 | *) 49 | echo $"Invalid OVS interface type $TYPE" 50 | exit 1 51 | ;; 52 | esac 53 | 54 | exit $retval 55 | -------------------------------------------------------------------------------- /datapath/linux/compat/include/linux/mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINUX_MUTEX_WRAPPER_H 2 | #define __LINUX_MUTEX_WRAPPER_H 3 | 4 | 5 | #include 6 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) 7 | 8 | #include 9 | 10 | struct mutex { 11 | struct semaphore sema; 12 | }; 13 | 14 | #define mutex_init(mutex) init_MUTEX(&(mutex)->sema) 15 | #define mutex_destroy(mutex) do { } while (0) 16 | 17 | #define __MUTEX_INITIALIZER(name) \ 18 | __SEMAPHORE_INITIALIZER(name, 1) 19 | 20 | #define DEFINE_MUTEX(mutexname) \ 21 | struct mutex mutexname = { __MUTEX_INITIALIZER(mutexname.sema) } 22 | 23 | /* 24 | * See kernel/mutex.c for detailed documentation of these APIs. 25 | * Also see Documentation/mutex-design.txt. 26 | */ 27 | static inline void mutex_lock(struct mutex *lock) 28 | { 29 | down(&lock->sema); 30 | } 31 | 32 | static inline int mutex_lock_interruptible(struct mutex *lock) 33 | { 34 | return down_interruptible(&lock->sema); 35 | } 36 | 37 | #define mutex_lock_nested(lock, subclass) mutex_lock(lock) 38 | #define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) 39 | 40 | /* 41 | * NOTE: mutex_trylock() follows the spin_trylock() convention, 42 | * not the down_trylock() convention! 43 | */ 44 | static inline int mutex_trylock(struct mutex *lock) 45 | { 46 | return !down_trylock(&lock->sema); 47 | } 48 | 49 | static inline void mutex_unlock(struct mutex *lock) 50 | { 51 | up(&lock->sema); 52 | } 53 | #else 54 | 55 | #include_next 56 | 57 | #endif /* linux version < 2.6.16 */ 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /utilities/bugtool/ovs-bugtool.8.in: -------------------------------------------------------------------------------- 1 | .\" -*- nroff -*- 2 | .de IQ 3 | . br 4 | . ns 5 | . IP "\\$1" 6 | .. 7 | .TH ovs\-bugtool 8 "@VERSION@" "Open vSwitch" "Open vSwitch Manual" 8 | .\" This program's name: 9 | .ds PN ovs\-bugtool 10 | . 11 | .SH NAME 12 | ovs\-bugtool \- Open vSwitch bug reporting utility 13 | . 14 | .SH SYNOPSIS 15 | .B ovs\-bugtool 16 | . 17 | .SH DESCRIPTION 18 | Generate a debug bundle with useful information about Open vSwitch on this 19 | system and places it in \fB/var/log/ovs-bugtool\fR. 20 | . 21 | .SH OPTIONS 22 | . 23 | .IP "\fB\-\-all\fR" 24 | Use all available capabilities. 25 | . 26 | .IP "\fB\-\-ovs\fR" 27 | Use only Open vSwitch relevant capabilities. 28 | . 29 | .IP "\fB\-\-capabilities\fR" 30 | List \fBovs\-bugtool\fR capabilities. 31 | . 32 | .IP "\fB\-\-debug\fR" 33 | Print verbose debugging output. 34 | . 35 | .IP "\fB\-\-entries=\fIlist\fR" 36 | Use the capabilities specified in a comma-separated list. 37 | . 38 | .IP "\fB\-\-output=\fIfiletype\fR" 39 | Generate a debug bundle with the specified file type. Options include 40 | \fBtar\fR, \fBtar.gz\fR, \fBtar.bz2\fR, and \fBzip\fR. 41 | . 42 | .IP "\fB\-\-silent\fR" 43 | Suppress output. 44 | . 45 | .IP "\fB\-\-unlimited\fR" 46 | Do not exclude files which are too large. 47 | . 48 | .IP "\fB\-\-yestoall\fR" 49 | Answer yes to all prompts. 50 | . 51 | .SH BUGS 52 | \fBovs\-bugtool\fR makes many assumptions about file locations and the 53 | availability of system utilities. It has been tested on Debian and 54 | Red Hat and derived distributions. On other distributions it is 55 | likely to be less useful. 56 | -------------------------------------------------------------------------------- /tests/atlocal.in: -------------------------------------------------------------------------------- 1 | # -*- shell-script -*- 2 | HAVE_OPENSSL='@HAVE_OPENSSL@' 3 | HAVE_PYTHON='@HAVE_PYTHON@' 4 | PERL='@PERL@' 5 | 6 | if test x"$PYTHON" = x; then 7 | PYTHON='@PYTHON@' 8 | fi 9 | 10 | PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH 11 | export PYTHONPATH 12 | 13 | PYTHONIOENCODING=utf_8 14 | export PYTHONIOENCODING 15 | 16 | # PYTHONDONTWRITEBYTECODE=yes keeps Python 2.6+ from creating .pyc and .pyo 17 | # files. Creating .py[co] works OK for any given version of Open 18 | # vSwitch, but it causes trouble if you switch from a version with 19 | # foo/__init__.py into an (older) version with plain foo.py, since 20 | # foo/__init__.pyc will cause Python to ignore foo.py. 21 | # 22 | # Python before version 2.6 always creates .pyc files, so if you develop 23 | # with such an older version then you're out of luck. 24 | PYTHONDONTWRITEBYTECODE=yes 25 | export PYTHONDONTWRITEBYTECODE 26 | 27 | if test $HAVE_PYTHON = yes; then 28 | if python -m argparse 2>/dev/null; then 29 | : 30 | else 31 | PYTHONPATH=$PYTHONPATH:$abs_top_srcdir/python/compat 32 | export PYTHONPATH 33 | fi 34 | fi 35 | 36 | # Enable malloc debugging features. 37 | case `uname` in 38 | Linux) 39 | MALLOC_CHECK_=2 40 | MALLOC_PERTURB_=165 41 | export MALLOC_CHECK_ 42 | export MALLOC_PERTURB_ 43 | ;; 44 | FreeBSD) 45 | case `uname -r` in 46 | [789].*) 47 | MALLOC_CONF=AJ 48 | ;; 49 | *) 50 | MALLOC_CONF=abort:true,junk:true,redzone:true 51 | ;; 52 | esac 53 | export MALLOC_CONF 54 | esac 55 | -------------------------------------------------------------------------------- /xenserver/automake.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009, 2010, 2011, 2012 Nicira, Inc. 2 | # 3 | # Copying and distribution of this file, with or without modification, 4 | # are permitted in any medium without royalty provided the copyright 5 | # notice and this notice are preserved. This file is offered as-is, 6 | # without warranty of any kind. 7 | 8 | EXTRA_DIST += \ 9 | xenserver/GPLv2 \ 10 | xenserver/LICENSE \ 11 | xenserver/README \ 12 | xenserver/automake.mk \ 13 | xenserver/etc_init.d_openvswitch \ 14 | xenserver/etc_init.d_openvswitch-xapi-update \ 15 | xenserver/etc_logrotate.d_openvswitch \ 16 | xenserver/etc_profile.d_openvswitch.sh \ 17 | xenserver/etc_xapi.d_plugins_openvswitch-cfg-update \ 18 | xenserver/etc_xensource_scripts_vif \ 19 | xenserver/openvswitch-xen.spec \ 20 | xenserver/openvswitch-xen.spec.in \ 21 | xenserver/opt_xensource_libexec_InterfaceReconfigure.py \ 22 | xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py \ 23 | xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py \ 24 | xenserver/opt_xensource_libexec_interface-reconfigure \ 25 | xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py \ 26 | xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync \ 27 | xenserver/usr_share_openvswitch_scripts_sysconfig.template 28 | 29 | $(srcdir)/xenserver/openvswitch-xen.spec: xenserver/openvswitch-xen.spec.in $(top_builddir)/config.status 30 | ($(ro_shell) && sed -e 's,[@]VERSION[@],$(VERSION),g') \ 31 | < $(srcdir)/xenserver/$(@F).in > $(@F).tmp || exit 1; \ 32 | if cmp -s $(@F).tmp $@; then touch $@; rm $(@F).tmp; else mv $(@F).tmp $@; fi 33 | -------------------------------------------------------------------------------- /datapath/vport-netdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2011 Nicira, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of version 2 of the GNU General Public 6 | * License as published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, but 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program; if not, write to the Free Software 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 | * 02110-1301, USA 17 | */ 18 | 19 | #ifndef VPORT_NETDEV_H 20 | #define VPORT_NETDEV_H 1 21 | 22 | #include 23 | #include 24 | 25 | #include "vport.h" 26 | 27 | struct vport *ovs_netdev_get_vport(struct net_device *dev); 28 | 29 | struct netdev_vport { 30 | struct rcu_head rcu; 31 | 32 | struct net_device *dev; 33 | }; 34 | 35 | static inline struct netdev_vport * 36 | netdev_vport_priv(const struct vport *vport) 37 | { 38 | return vport_priv(vport); 39 | } 40 | 41 | int ovs_netdev_set_addr(struct vport *, const unsigned char *addr); 42 | const char *ovs_netdev_get_name(const struct vport *); 43 | const unsigned char *ovs_netdev_get_addr(const struct vport *); 44 | const char *ovs_netdev_get_config(const struct vport *); 45 | int ovs_netdev_get_ifindex(const struct vport *); 46 | 47 | #endif /* vport_netdev.h */ 48 | -------------------------------------------------------------------------------- /lib/fatal-signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FATAL_SIGNAL_H 18 | #define FATAL_SIGNAL_H 1 19 | 20 | #include 21 | 22 | /* Basic interface. */ 23 | void fatal_signal_add_hook(void (*hook_cb)(void *aux), 24 | void (*cancel_cb)(void *aux), void *aux, 25 | bool run_at_exit); 26 | void fatal_signal_fork(void); 27 | void fatal_signal_run(void); 28 | void fatal_signal_wait(void); 29 | 30 | /* Convenience functions for unlinking files upon termination. 31 | * 32 | * These functions also unlink the files upon normal process termination via 33 | * exit(). */ 34 | void fatal_signal_add_file_to_unlink(const char *); 35 | void fatal_signal_remove_file_to_unlink(const char *); 36 | int fatal_signal_unlink_file_now(const char *); 37 | 38 | /* Interface for other code that catches one of our signals and needs to pass 39 | * it through. */ 40 | void fatal_signal_handler(int sig_nr); 41 | 42 | #endif /* fatal-signal.h */ 43 | -------------------------------------------------------------------------------- /debian/openvswitch-pki.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # postinst script for openvswitch-pki 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `configure' 10 | # * `abort-upgrade' 11 | # * `abort-remove' `in-favour' 12 | # 13 | # * `abort-remove' 14 | # * `abort-deconfigure' `in-favour' 15 | # `removing' 16 | # 17 | # for details, see http://www.debian.org/doc/debian-policy/ or 18 | # the debian-policy package 19 | 20 | case "$1" in 21 | configure) 22 | # Move the pki directory from its previous, non FHS-compliant location, 23 | # to its new location, leaving behind a symlink for compatibility. 24 | if test -d /usr/share/openvswitch/pki && \ 25 | test ! -e /var/lib/openvswitch/pki; then 26 | mv /usr/share/openvswitch/pki /var/lib/openvswitch 27 | ln -s /var/lib/openvswitch/pki /usr/share/openvswitch/pki 28 | fi 29 | 30 | # Create certificate authorities. 31 | if test ! -e /var/lib/openvswitch/pki; then 32 | ovs-pki init 33 | fi 34 | ;; 35 | 36 | abort-upgrade|abort-remove|abort-deconfigure) 37 | ;; 38 | 39 | *) 40 | echo "postinst called with unknown argument \`$1'" >&2 41 | exit 1 42 | ;; 43 | esac 44 | 45 | #DEBHELPER# 46 | 47 | exit 0 48 | 49 | 50 | -------------------------------------------------------------------------------- /lib/learn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LEARN_H 18 | #define LEARN_H 1 19 | 20 | #include "ofp-errors.h" 21 | 22 | struct ds; 23 | struct flow; 24 | struct ofpbuf; 25 | struct ofpact_learn; 26 | struct ofputil_flow_mod; 27 | struct nx_action_learn; 28 | 29 | /* NXAST_LEARN helper functions. 30 | * 31 | * See include/openflow/nicira-ext.h for NXAST_LEARN specification. 32 | */ 33 | 34 | enum ofperr learn_from_openflow(const struct nx_action_learn *, 35 | struct ofpbuf *ofpacts); 36 | enum ofperr learn_check(const struct ofpact_learn *, const struct flow *); 37 | void learn_to_nxast(const struct ofpact_learn *, struct ofpbuf *openflow); 38 | 39 | void learn_execute(const struct ofpact_learn *, const struct flow *, 40 | struct ofputil_flow_mod *, struct ofpbuf *ofpacts); 41 | 42 | void learn_parse(char *, const struct flow *, struct ofpbuf *ofpacts); 43 | void learn_format(const struct ofpact_learn *, struct ds *); 44 | 45 | #endif /* learn.h */ 46 | -------------------------------------------------------------------------------- /lib/type-props.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TYPE_PROPS_H 18 | #define TYPE_PROPS_H 1 19 | 20 | #include 21 | 22 | #define TYPE_IS_INTEGER(TYPE) ((TYPE) 1.5 == (TYPE) 1) 23 | #define TYPE_IS_SIGNED(TYPE) ((TYPE) 1 > (TYPE) -1) 24 | #define TYPE_VALUE_BITS(TYPE) (sizeof(TYPE) * CHAR_BIT - TYPE_IS_SIGNED(TYPE)) 25 | #define TYPE_MINIMUM(TYPE) (TYPE_IS_SIGNED(TYPE) \ 26 | ? ~(TYPE)0 << TYPE_VALUE_BITS(TYPE) \ 27 | : 0) 28 | #define TYPE_MAXIMUM(TYPE) (TYPE_IS_SIGNED(TYPE) \ 29 | ? ~(~(TYPE)0 << TYPE_VALUE_BITS(TYPE)) \ 30 | : (TYPE)-1) 31 | 32 | /* Number of decimal digits required to format an integer of the given TYPE. 33 | * Includes space for a sign, if TYPE is signed, but not for a null 34 | * terminator. 35 | * 36 | * The value is an overestimate. */ 37 | #define INT_STRLEN(TYPE) (TYPE_IS_SIGNED(TYPE) + TYPE_VALUE_BITS(TYPE) / 3 + 1) 38 | 39 | #endif /* type-props.h */ 40 | -------------------------------------------------------------------------------- /python/ovs/process.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010, 2011 Nicira, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import signal 17 | 18 | 19 | def _signal_status_msg(type_, signr): 20 | s = "%s by signal %d" % (type_, signr) 21 | for name in signal.__dict__: 22 | if name.startswith("SIG") and getattr(signal, name) == signr: 23 | return "%s (%s)" % (s, name) 24 | return s 25 | 26 | 27 | def status_msg(status): 28 | """Given 'status', which is a process status in the form reported by 29 | waitpid(2) and returned by process_status(), returns a string describing 30 | how the process terminated.""" 31 | if os.WIFEXITED(status): 32 | s = "exit status %d" % os.WEXITSTATUS(status) 33 | elif os.WIFSIGNALED(status): 34 | s = _signal_status_msg("killed", os.WTERMSIG(status)) 35 | elif os.WIFSTOPPED(status): 36 | s = _signal_status_msg("stopped", os.WSTOPSIG(status)) 37 | else: 38 | s = "terminated abnormally (%x)" % status 39 | if os.WCOREDUMP(status): 40 | s += ", core dumped" 41 | return s 42 | -------------------------------------------------------------------------------- /lib/sat-math.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SAT_MATH_H 18 | #define SAT_MATH_H 1 19 | 20 | #include 21 | #include 22 | 23 | /* Saturating addition: overflow yields UINT_MAX. */ 24 | static inline unsigned int 25 | sat_add(unsigned int x, unsigned int y) 26 | { 27 | return x + y >= x ? x + y : UINT_MAX; 28 | } 29 | 30 | /* Saturating subtraction: underflow yields 0. */ 31 | static inline unsigned int 32 | sat_sub(unsigned int x, unsigned int y) 33 | { 34 | return x >= y ? x - y : 0; 35 | } 36 | 37 | /* Saturating multiplication of "unsigned int"s: overflow yields UINT_MAX. */ 38 | #define SAT_MUL(X, Y) \ 39 | ((Y) == 0 ? 0 \ 40 | : (X) <= UINT_MAX / (Y) ? (unsigned int) (X) * (unsigned int) (Y) \ 41 | : UINT_MAX) 42 | static inline unsigned int 43 | sat_mul(unsigned int x, unsigned int y) 44 | { 45 | return SAT_MUL(x, y); 46 | } 47 | 48 | #endif /* sat-math.h */ 49 | -------------------------------------------------------------------------------- /lib/token-bucket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TOKEN_BUCKET_H 18 | #define TOKEN_BUCKET_H 1 19 | 20 | #include 21 | #include 22 | 23 | struct token_bucket { 24 | /* Configuration settings. */ 25 | unsigned int rate; /* Tokens added per millisecond. */ 26 | unsigned int burst; /* Max cumulative tokens credit. */ 27 | 28 | /* Current status. */ 29 | unsigned int tokens; /* Current number of tokens. */ 30 | long long int last_fill; /* Last time tokens added. */ 31 | }; 32 | 33 | #define TOKEN_BUCKET_INIT(RATE, BURST) { RATE, BURST, 0, LLONG_MIN } 34 | 35 | void token_bucket_init(struct token_bucket *, 36 | unsigned int rate, unsigned int burst); 37 | void token_bucket_set(struct token_bucket *, 38 | unsigned int rate, unsigned int burst); 39 | bool token_bucket_withdraw(struct token_bucket *, unsigned int n); 40 | void token_bucket_wait(struct token_bucket *, unsigned int n); 41 | 42 | #endif /* token-bucket.h */ 43 | -------------------------------------------------------------------------------- /ofproto/fail-open.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FAIL_OPEN_H 18 | #define FAIL_OPEN_H 1 19 | 20 | #include 21 | #include 22 | #include "flow.h" 23 | 24 | struct connmgr; 25 | struct fail_open; 26 | struct ofproto; 27 | 28 | /* Priority of the rule added by the fail-open subsystem when a switch enters 29 | * fail-open mode. This priority value uniquely identifies a fail-open flow 30 | * (OpenFlow priorities max out at 65535 and nothing else in Open vSwitch 31 | * creates flows with this priority). And "f0" is mnemonic for "fail open"! */ 32 | #define FAIL_OPEN_PRIORITY 0xf0f0f0 33 | 34 | struct fail_open *fail_open_create(struct ofproto *, struct connmgr *); 35 | void fail_open_destroy(struct fail_open *); 36 | void fail_open_wait(struct fail_open *); 37 | bool fail_open_is_active(const struct fail_open *); 38 | void fail_open_run(struct fail_open *); 39 | void fail_open_maybe_recover(struct fail_open *); 40 | void fail_open_flushed(struct fail_open *); 41 | 42 | #endif /* fail-open.h */ 43 | -------------------------------------------------------------------------------- /lib/ofp-print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2009, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* OpenFlow protocol pretty-printer. */ 18 | 19 | #ifndef OFP_PRINT_H 20 | #define OFP_PRINT_H 1 21 | 22 | #include 23 | #include 24 | 25 | struct ds; 26 | struct ofp10_match; 27 | struct ofp_flow_mod; 28 | struct ofp_header; 29 | struct ofputil_flow_stats; 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | void ofp_print(FILE *, const void *, size_t, int verbosity); 36 | void ofp_print_packet(FILE *stream, const void *data, size_t len); 37 | 38 | void ofp10_match_print(struct ds *, const struct ofp10_match *, int verbosity); 39 | 40 | char *ofp_to_string(const void *, size_t, int verbosity); 41 | char *ofp10_match_to_string(const struct ofp10_match *, int verbosity); 42 | char *ofp_packet_to_string(const void *data, size_t len); 43 | 44 | void ofp_print_flow_stats(struct ds *, struct ofputil_flow_stats *); 45 | void ofp_print_version(const struct ofp_header *, struct ds *); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* ofp-print.h */ 52 | -------------------------------------------------------------------------------- /lib/multipath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, 2011, 2012 Nicira, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef MULTIPATH_H 18 | #define MULTIPATH_H 1 19 | 20 | #include 21 | #include "ofp-errors.h" 22 | 23 | struct ds; 24 | struct flow; 25 | struct nx_action_multipath; 26 | struct ofpact_multipath; 27 | struct ofpbuf; 28 | 29 | /* NXAST_MULTIPATH helper functions. 30 | * 31 | * See include/openflow/nicira-ext.h for NXAST_MULTIPATH specification. 32 | */ 33 | 34 | enum ofperr multipath_from_openflow(const struct nx_action_multipath *, 35 | struct ofpact_multipath *); 36 | enum ofperr multipath_check(const struct ofpact_multipath *, 37 | const struct flow *); 38 | void multipath_to_nxast(const struct ofpact_multipath *, 39 | struct ofpbuf *openflow); 40 | 41 | void multipath_execute(const struct ofpact_multipath *, struct flow *); 42 | 43 | void multipath_parse(struct ofpact_multipath *, const char *); 44 | void multipath_format(const struct ofpact_multipath *, struct ds *); 45 | 46 | #endif /* multipath.h */ 47 | -------------------------------------------------------------------------------- /tests/test-vlog.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2011 Nicira, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import argparse 16 | 17 | import ovs.vlog 18 | 19 | 20 | def main(): 21 | modules = [ovs.vlog.Vlog("module_%d" % i) for i in xrange(3)] 22 | 23 | parser = argparse.ArgumentParser(description="Vlog Module Tester") 24 | ovs.vlog.add_args(parser) 25 | args = parser.parse_args() 26 | ovs.vlog.handle_args(args) 27 | 28 | for m in modules: 29 | m.emer("emergency") 30 | m.err("error") 31 | m.warn("warning") 32 | m.info("information") 33 | m.dbg("debug") 34 | 35 | try: 36 | fail = False # Silence pychecker warning. 37 | assert fail 38 | except AssertionError: 39 | m.emer("emergency exception", exc_info=True) 40 | m.err("error exception", exc_info=True) 41 | m.warn("warn exception", exc_info=True) 42 | m.info("information exception", exc_info=True) 43 | m.dbg("debug exception", exc_info=True) 44 | m.exception("exception") 45 | 46 | 47 | if __name__ == '__main__': 48 | main() 49 | --------------------------------------------------------------------------------