summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* packets: Fix typo in reserved multicast Ethernet addresses.Ben Pfaff2013-06-051-16/+16
| | | | | | | | | The reserved multicast Ethernet addresses begin with 01:80:c2, not 01:08:c2. Reported-by: Padmanabhan Krishnan <kprad1@yahoo.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Fix misspellings in comments and docs.Andy Hill2013-06-049-11/+11
| | | | | | | | Flagged with: https://github.com/lyda/misspell-check Run with: git ls-files | misspellings -f - Signed-off-by: Andy Hill <hillad@gmail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Always use valid ids pointer in dec_ttl_cnt_ids_from_openflow()Simon Horman2013-06-041-1/+1
| | | | | | | | | | | | | | | Always update the ids pointer after calling ofpbuf_put() to ensure that it is valid when accessed. During testing a case came up where the call to ofpbuf_put() in the for (i = 0; i < ids->n_controllers; i++) loop would cause the underlying buffer to be reallocated. This resulted in ids->n_controllers being an incorrect value, the loop continuing on longer than desired and finally a segmentation fault. Reported-by: Joe Stringer <joe@wand.net.nz> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* cfm: Update netdev when changed.Ethan Jackson2013-06-032-0/+11
| | | | | | | | | If ofproto decided to change the netdev of a particular ofport, cfm_demand mode would improperly continue using the old netdev to collect stats. Bug #17583. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Implement duration fields in OpenFlow 1.3 port stats.Ben Pfaff2013-05-303-10/+15
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* odp-util: Make slow_path_reasons mutually exclusive.Ethan Jackson2013-05-292-25/+40
| | | | | | | | It's no longer possible for a single datapath flow to be slow pathed for two different reasons. This patch updates the code to reflect this fact (marginally simplifying it). Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofproto: Ditch SLOW_IN_BAND slow path reason.Ethan Jackson2013-05-292-8/+2
| | | | | | | | | | | | | | Before this patch, when in band control was enabled, every DHCP packet had to be sent to userspace to calculate it's actions. Those DHCP packets intended for the local port would have a special action added to ensure they actually make it there. This unnecessarily complicates the code, so this patch takes a slightly different approach. When in-band is enabled, *all* DHCP packets must be sent to the local port. This guarantees that xlate_actions() returns the same result every time for a given flow. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofproto-dpif: Ditch SLOW_MATCH slow path reason.Ethan Jackson2013-05-292-6/+0
| | | | | | | | | | | | | Before this patch, datapath keys with ODP_FIT_TO_LITTLE, would be assigned subfacets and installed in the kernel with a SLOW_MATCH slow path reason. This is problematic, because these flow keys can't be reliable converted into a 'struct flow' thus breaking a fundamental assumption of ofproto-dpif. This patch circumvents the issue by skipping facet creation for these flows altogether. This approach has the added benefit of simplifying the code for future patches. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* ofpbuf: New helper ofpbuf_equal().Ethan Jackson2013-05-291-0/+6
| | | | | | Used in future commits. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* odp-execute: New module for executing datapath actions.Simon Horman2013-05-294-163/+246
| | | | | | | | | | | This moves generic action execution code out of lib/dpif-netedev.c and into a new file, lib/odp-execute.c. This is in preparation for using odp_execute_actions() in lib/odp-util.c to handle recirculation/ Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-dummy: Add "pstream" option for connecting a dummy to a process.Ben Pfaff2013-05-281-12/+232
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-dummy: Drop "nobody listened" reply from netdev-dummy/receive.Ben Pfaff2013-05-281-15/+3
| | | | | | Ethan pointed out that this wasn't very useful. Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-dummy: Factor some netdev_dummy_receive() code out into new function.Ben Pfaff2013-05-281-10/+22
| | | | | | An upcoming patch will add another user. Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-dummy: Limit receive queue length to 100 packets.Ben Pfaff2013-05-281-2/+13
| | | | | | | It doesn't seem like a good idea to allow the queue length to grow without bound, even for a test-only device. Signed-off-by: Ben Pfaff <blp@nicira.com>
* BFD: Reconfigure BFD on port deletion.Pavithra Ramesh2013-05-281-2/+3
| | | | | | | | Invoke the function to reconfigure BFD when a port/interface is deleted. Signed-off-by: Pavithra Ramesh <paramesh@vmware.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
* netdev-bsd: Silence warnings on unimplemented platform.Ed Maste2013-05-241-2/+3
| | | | | | | | netdev_bsd_get_next_hop currently lacks an implementation on FreeBSD, so its arguments are unused; mark them so. Signed-off-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
* dpif-netdev: Move decoding of data out of dp_netdev_output_userspace()Simon Horman2013-05-231-6/+7
| | | | | | | | | This is in preparation for making dp_netdev_action_userspace() more generic and passing dp_netdev_output_userspace() as a callback. In this case it makes sense to decode userdata in generic code. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* dpif-netdev: Constify key parameter of dp_netdev_action_userspace()Simon Horman2013-05-231-1/+1
| | | | | Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-errors: Add missing copyright and license notice.Ben Pfaff2013-05-231-0/+16
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-bsd: Correct pointer use after refactoring.Ed Maste2013-05-231-2/+2
| | | | | | | Introduced in commit 666afb55e84e9118812de81a75655ec9567b7a5b. Signed-off-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
* factor out a function to extract stats from if_data to netdev_stats.YAMAMOTO Takashi2013-05-221-49/+31
| | | | | | | suggested by Ed Maste. Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* implement get_next_hop for NetBSDYAMAMOTO Takashi2013-05-221-2/+149
| | | | | Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* implement get_stats for NetBSDYAMAMOTO Takashi2013-05-221-5/+42
| | | | | Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* implement set_etheraddr for NetBSDYAMAMOTO Takashi2013-05-221-3/+53
| | | | Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
* missing ifdef netbsd guard for af_link_sockYAMAMOTO Takashi2013-05-221-0/+2
| | | | | | | pointed out by Ed Maste Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-bsd: NetBSD: keep a AF_LINK socket openYAMAMOTO Takashi2013-05-221-1/+14
| | | | | | | this will be used for get_stats and set_etheraddr Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* keep "kernel name" for each netdevYAMAMOTO Takashi2013-05-221-19/+35
| | | | | | | | | | | | | where interface renaming is not supported (NetBSD), remember both of our netdev name and the correspoinding kernel name separately. the latter is necessary to talk with kernel using interface names. eg. ifioctls, bpf XXX there should be a proper way to query kernel name. Ben Pfaff suggested ovs-appctl but this patch doesn't implement it. (yet) Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* add minimal NetBSD supportYAMAMOTO Takashi2013-05-225-14/+58
| | | | | | | mostly ride on the existing FreeBSD support. Signed-off-by: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> Signed-off-by: Ben Pfaff <blp@nicira.com>
* cfm: Implement "demand mode".Ethan Jackson2013-05-222-8/+48
| | | | | | | | The new CFM "demand mode" (named after BFD's demand mode) uses data traffic to indicate interface liveness. It's helpful on heavily congested networks where CCMs may be dropped. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* netdev: New function netdev_ref().Ben Pfaff2013-05-222-0/+12
| | | | | | | | | I suspect that this makes it easier to make sure that a netdev stays open as long as needed in some cases where a module needs access to a netdev opened by some higher-level module. CC: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-util: Make ofputil_port_from_ofp11() return OFPP_NONE on error.Ben Pfaff2013-05-202-10/+5
| | | | | | | | | This makes life easier for a few callers, and it agrees with my usual preference that a function should fill in its output parameters whether it succeeds or not. CC: Jarno Rajahalme <jarno.rajahalme@nsn.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* meta-flow: Add MFF_IN_PORT_OXM, a 32-bit in_port.Jarno Rajahalme2013-05-203-12/+74
| | | | | | | | | | | This helps get rid of one special case in nx_pull_raw() and allows loading of 32-bit values from/to OXM_OF_IN_PORT in NXAST_LEARN actions. Previously the 16-bit limit acted the same on both NXM_OF_IN_PORT and OXM_OF_IN_PORT, even though OF1.1+ controllers would expect OXM_OF_IN_PORT to be 32 bits wide. Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-dummy: Remove FreeBSD dependency.Ben Pfaff2013-05-182-11/+7
| | | | | | | | | | | | There's no particular reason that netdev_dummy_register() has to care about the particular OS, except that the tests like to use the special Linux-only tunnel vport types. But that can be done better, I think, by just always registering them from netdev_dummy_register() and making that function idempotent, so that calling it twice under Linux has no additional effect. This commit implements that solution. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ed Maste <emaste@freebsd.org>
* Allow hexdump of packet data of PACKET_{IN, OUT} messagesSimon Horman2013-05-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If verbosity parameter of ofp_print_packet_{in,out}() is greater than 2 then when formatting packet data include a hex dump as well as the output of ofp_packet_to_string(), which is already included if verbosity is greater than 0. This feature may be accesed in serveral ways including: * Including the -m parameter in an invoocation of ovs-ofctl monitor. * Including a verbosity greater than 2 in an invocation of ovs-ofctl ofp-print. This patch includes tests to exercise this feature using ovs-ofctl ofp-print. The motivation of this is to allow tests to be written that use ovs-ofctl -m monitor to check packet data which is not output by ofp_packet_to_string(). Specifically, as the protocol of the inner-packet is not known by ofp_packet_to_string() it only decodes and stringifies an MPLS packet up to and including the first MPLS label stack entry. However it may be useful to create tests which verify the contents of the inner packet. One example may be verify the effect of dec_ttl in the following sequence of actions applied to a packet with a single MPLS label stack entry. pop_mpls(0x800),dec_ttl,push_mpls(0x8847) Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* ofp-print: ofp_packet_to_string() Do not emit extra trailing newlineSimon Horman2013-05-161-1/+0
| | | | | | | | | | | | | | | | | | | The string produced by ofp_packet_to_string() includes a trailing newline, so in the case where packet data is formatted by ofp_print_packet_out() there is already a newline present. This patch updates ofp_print_packet_out() so that it does not add a second newline in this case. It is not necessary to update the case where there is packet data to ensure that the result it is terminated by a "\n" as the higher-level ofp_to_string() function will ensure that the result is "\n" terminated. The test-suite has be updated to exercise output of packet data by ofp_packet_to_string() Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib/mac-learning.h: Change one variable's type and nameAlex Wang2013-05-162-4/+4
| | | | | | | | This commit changes variable "int i" of "union port" of "struct mac_entry" to "uint16_t ofp_port", since it is used to store the OpenFlow port number. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Prevent using reserved namesAlex Wang2013-05-164-4/+49
| | | | | | | | | | This commit adds a function to lib/netdev.c to check that the interface name is not the same as any of the registered vport providers' dpif_port name (e.g. gre_system) or the datapath's internal port name (e.g. ovs-system). Bug #15077. Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Do not include trailing whitespace in hexdump.Ben Pfaff2013-05-161-0/+2
| | | | | | Reported-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com> Tested-by: Simon Horman <horms@verge.net.au>
* dynamic-string: Fix style of ds_put_hex_dump().Ben Pfaff2013-05-161-39/+39
| | | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com> Tested-by: Simon Horman <horms@verge.net.au>
* netdev-linux: Skip NETDEV_UP test in netdev_linux_set_etheraddr() for taps.Ben Pfaff2013-05-131-5/+1
| | | | | | | | | netdev_turn_flags_off() does nothing if the flags that one turns off are already off. Reported-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* netdev: Get rid of netdev_dev.Ben Pfaff2013-05-106-1079/+723
| | | | | | | | | | | | The distinction between struct netdev_dev and struct netdev has always been confusing. Now that previous commits have eliminated all interesting state from struct netdev, this commit deletes it and renames struct netdev_dev to take its place. Now the situation makes much more sense and I won't have to continue making embarrassed explanations in the future. Good riddance. Signed-off-by: Ben Pfaff <blp@nicira.com>
* Rename superclass members to 'up'.Ben Pfaff2013-05-104-44/+44
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* netdev: Add new "struct netdev_rx" for capturing packets from a netdev.Ben Pfaff2013-05-108-389/+469
| | | | | | | | | Separating packet capture from "struct netdev" means that there is no remaining per-"struct netdev" state, which will allow us to get rid of "struct netdev_dev" (by renaming it "struct netdev"). Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* meta-flow: Simplify mf_from_ofp_port_string()Jarno Rajahalme2013-05-101-7/+3
| | | | | | | ofputil_port_from_string() does all the work already. Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev-bsd: Adjust argument line wrappingEd Maste2013-05-101-9/+9
| | | | | | | | This file presumably started out life as a copy of netdev-linux.c, and some indentation was not updated after s/linux/bsd/. Signed-off-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ben Pfaff <blp@nicira.com>
* netdev: Factor restoring flags into new "struct netdev_saved_flags".Ben Pfaff2013-05-108-128/+169
| | | | | | | | | | | | | This gets rid of the only per-instance data in "struct netdev", which will make it possible to merge "struct netdev_dev" into "struct netdev" in a later commit. Ed Maste wrote the netdev-bsd changes in this commit. Signed-off-by: Ben Pfaff <blp@nicira.com> Co-authored-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Ed Maste <emaste@freebsd.org> Tested-by: Ed Maste <emaste@freebsd.org>
* OpenFlow-level flow-based tunneling support.Jarno Rajahalme2013-05-109-31/+65
| | | | | | | | | | | | | | | | | | | | | Adds tun_src and tun_dst match and set capabilities via new NXM fields NXM_NX_TUN_IPV4_SRC and NXM_NX_TUN_IPV4_DST. This allows management of large number of tunnels via the flow tables, without requiring the tunnels to be pre-configured. Flow-based tunnels can be configured with options remote_ip=flow and local_ip=flow. local_ip=flow requires remote_ip=flow. When set, the tunnel remote IP address and/or local IP address is set from the flow, instead of the tunnel configuration. Example: $ ovs-vsctl add-port br0 gre -- set Interface gre ofport_request=1 type=gre options:remote_ip=flow options:key=flow $ ovs-ofctl add-flow br0 "in_port=LOCAL actions=set_tunnel:1,set_field:192.168.0.1->tun_dst,output:1" $ ovs-ofctl add-flow br0 "in_port=1 tun_src=192.168.0.1 tun_id=1 actions=LOCAL" Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Use updated dl_type when checking actions that use fieldsSimon Horman2013-05-101-8/+16
| | | | | | | | | | | | | | | | | | | | | | | Update handling of the following actions to use the dl_type set by MPLS push and pop actions if it differs from the original dl_type. This is consistent with the existing checking of load actions and allows their existing checks to enforce dl_type pre-requisites correctly. output_reg bundle reg_move stack_push stack_pop learn multipath In order to avoid the verbosity of updating the flow for each applicable action the update is treated as a common case and performed in ofpact_check(). This was suggested by Jesse Gross. Cc: Jesse Gross <jesse@nicira.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com>
* ofpbuf: Fix small typo.Justin Pettit2013-05-091-1/+1
| | | | Signed-off-by: Justin Pettit <jpettit@nicira.com>
* flow: Fix IPv6 fragment packet handlingTakashi Kawaguchi2013-05-091-3/+2
| | | | | | | | | | | IPv6 fragmented packet (except first fragment) will not be handled correctly. When extracting packet at parse_ipv6(), although nw_frag should have both of FLOW_NW_FRAG_ANY and FLOW_NW_FRAG_LATER for later fragment, only FLOW_NW_FRAG_LATER is set. Signed-off-by: Takashi Kawaguchi <kawaguchi-takashi@mxd.nes.nec.co.jp> Signed-off-by: Ken Ajiro <ajiro@mxw.nes.nec.co.jp> Signed-off-by: Jesse Gross <jesse@nicira.com>