#include "ofproto-dpif-governor.h"
#include "ofproto-dpif-sflow.h"
#include "poll-loop.h"
+#include "simap.h"
#include "timer.h"
#include "unaligned.h"
#include "unixctl.h"
cls_rule_init_catchall(&fm.cr, 0);
cls_rule_set_reg(&fm.cr, 0, id);
+ fm.new_cookie = htonll(0);
fm.cookie = htonll(0);
fm.cookie_mask = htonll(0);
fm.table_id = TBL_INTERNAL;
}
}
+static void
+get_memory_usage(const struct ofproto *ofproto_, struct simap *usage)
+{
+ const struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
+
+ simap_increase(usage, "facets", hmap_count(&ofproto->facets));
+ simap_increase(usage, "subfacets", hmap_count(&ofproto->subfacets));
+}
+
static void
flush(struct ofproto *ofproto_)
{
return !m->vlans || bitmap_is_set(m->vlans, vlan);
}
-/* Returns true if a packet with Ethernet destination MAC 'dst' may be mirrored
- * to a VLAN. In general most packets may be mirrored but we want to drop
- * protocols that may confuse switches. */
-static bool
-eth_dst_may_rspan(const uint8_t dst[ETH_ADDR_LEN])
-{
- /* If you change this function's behavior, please update corresponding
- * documentation in vswitch.xml at the same time. */
- if (dst[0] != 0x01) {
- /* All the currently banned MACs happen to start with 01 currently, so
- * this is a quick way to eliminate most of the good ones. */
- } else {
- if (eth_addr_is_reserved(dst)) {
- /* Drop STP, IEEE pause frames, and other reserved protocols
- * (01-80-c2-00-00-0x). */
- return false;
- }
-
- if (dst[0] == 0x01 && dst[1] == 0x00 && dst[2] == 0x0c) {
- /* Cisco OUI. */
- if ((dst[3] & 0xfe) == 0xcc &&
- (dst[4] & 0xfe) == 0xcc &&
- (dst[5] & 0xfe) == 0xcc) {
- /* Drop the following protocols plus others following the same
- pattern:
-
- CDP, VTP, DTP, PAgP (01-00-0c-cc-cc-cc)
- Spanning Tree PVSTP+ (01-00-0c-cc-cc-cd)
- STP Uplink Fast (01-00-0c-cd-cd-cd) */
- return false;
- }
-
- if (!(dst[3] | dst[4] | dst[5])) {
- /* Drop Inter Switch Link packets (01-00-0c-00-00-00). */
- return false;
- }
- }
- }
- return true;
-}
-
static void
add_mirror_actions(struct action_xlate_ctx *ctx, const struct flow *orig_flow)
{
ctx->mirrors |= m->dup_mirrors;
if (m->out) {
output_normal(ctx, m->out, vlan);
- } else if (eth_dst_may_rspan(orig_flow->dl_dst)
- && vlan != m->out_vlan) {
+ } else if (vlan != m->out_vlan
+ && !eth_addr_is_reserved(orig_flow->dl_dst)) {
struct ofbundle *bundle;
HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
/* Drop frames for reserved multicast addresses
* only if forward_bpdu option is absent. */
- if (eth_addr_is_reserved(flow->dl_dst) && !ofproto->up.forward_bpdu) {
+ if (!ofproto->up.forward_bpdu && eth_addr_is_reserved(flow->dl_dst)) {
return false;
}
run,
run_fast,
wait,
+ get_memory_usage,
flush,
get_features,
get_tables,