summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2016-11-18 16:56:09 +0000
committerreyk <reyk@openbsd.org>2016-11-18 16:56:09 +0000
commitc7cf96ed2d04d4dc741b8efcf512794d3452790a (patch)
tree58462fb203bb6596839b39e2012417ddd0fb4096
parentDefine constmap in ofp_map.h to be shared along with ofp_map.c (diff)
downloadwireguard-openbsd-c7cf96ed2d04d4dc741b8efcf512794d3452790a.tar.xz
wireguard-openbsd-c7cf96ed2d04d4dc741b8efcf512794d3452790a.zip
Define a group_id map and rename the defines accordingly.
Requested by rzalamena@
-rw-r--r--sys/net/ofp.h9
-rw-r--r--sys/net/switchofp.c8
-rw-r--r--usr.sbin/switchd/ofp13.c4
-rw-r--r--usr.sbin/switchd/ofp_map.h3
4 files changed, 13 insertions, 11 deletions
diff --git a/sys/net/ofp.h b/sys/net/ofp.h
index d2cdea98145..9732841dbd2 100644
--- a/sys/net/ofp.h
+++ b/sys/net/ofp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp.h,v 1.9 2016/11/18 14:54:22 reyk Exp $ */
+/* $OpenBSD: ofp.h,v 1.10 2016/11/18 16:56:09 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -638,9 +638,10 @@ struct ofp_error {
#define OFP_GROUP_T_INDIRECT 2 /* Indirect group */
#define OFP_GROUP_T_FAST_FAILOVER 3 /* Fast failover group */
-#define OFP_GROUP_MAX 0xffffff00 /* Last usable group number */
-#define OFP_GROUP_ALL 0xfffffffc /* Represents all groups for delete command */
-#define OFP_GROUP_ANY 0xffffffff /* Special wildcard: no group specified */
+/* Special group identifiers */
+#define OFP_GROUP_ID_MAX 0xffffff00 /* Last usable group number */
+#define OFP_GROUP_ID_ALL 0xfffffffc /* Represents all groups for delete command */
+#define OFP_GROUP_ID_ANY 0xffffffff /* Special wildcard: no group specified */
struct ofp_bucket {
uint16_t b_len;
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c
index d8760c63c78..4a491f297bc 100644
--- a/sys/net/switchofp.c
+++ b/sys/net/switchofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchofp.c,v 1.32 2016/11/18 16:23:13 rzalamena Exp $ */
+/* $OpenBSD: switchofp.c,v 1.33 2016/11/18 16:56:09 reyk Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -2090,7 +2090,7 @@ swofp_flow_filter(struct swofp_flow_entry *swfe, uint64_t cookie,
((swfe->swfe_cookie & cookie_mask) != (cookie & cookie_mask)))
return (0);
- if ((out_port == OFP_PORT_ANY) && (out_group == OFP_GROUP_ALL))
+ if ((out_port == OFP_PORT_ANY) && (out_group == OFP_GROUP_ID_ALL))
return (1);
if ((out_port != OFP_PORT_ANY) &&
@@ -2098,7 +2098,7 @@ swofp_flow_filter(struct swofp_flow_entry *swfe, uint64_t cookie,
swofp_flow_filter_out_port(swfe->swfe_apply_actions, out_port)))
return (0);
- if (out_port != OFP_GROUP_ALL) {
+ if (out_port != OFP_GROUP_ID_ALL) {
/* XXX ignore group */
}
@@ -5292,7 +5292,7 @@ swofp_group_mod_delete(struct switch_softc *sc, struct mbuf *m)
ogm = mtod(m, struct ofp_group_mod *);
group_id = ntohl(ogm->gm_group_id);
- if (group_id == OFP_GROUP_ALL)
+ if (group_id == OFP_GROUP_ID_ALL)
swofp_group_entry_delete_all(sc);
else if ((swge = swofp_group_entry_lookup(sc, group_id)) != NULL)
swofp_group_entry_delete(sc, swge);
diff --git a/usr.sbin/switchd/ofp13.c b/usr.sbin/switchd/ofp13.c
index f875e6876ab..11fc46cbd5a 100644
--- a/usr.sbin/switchd/ofp13.c
+++ b/usr.sbin/switchd/ofp13.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp13.c,v 1.31 2016/11/18 13:15:42 rzalamena Exp $ */
+/* $OpenBSD: ofp13.c,v 1.32 2016/11/18 16:56:09 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -644,7 +644,7 @@ ofp13_features_reply(struct switchd *sc, struct switch_connection *con,
{
#if 0
/* Let's not ask this while we don't use it. */
- ofp13_flow_stats(sc, con, OFP_PORT_ANY, OFP_GROUP_ANY,
+ ofp13_flow_stats(sc, con, OFP_PORT_ANY, OFP_GROUP_ID_ANY,
OFP_TABLE_ID_ALL);
ofp13_table_features(sc, con, 0);
ofp13_desc(sc, con);
diff --git a/usr.sbin/switchd/ofp_map.h b/usr.sbin/switchd/ofp_map.h
index 5c22d20b693..3519ed175c2 100644
--- a/usr.sbin/switchd/ofp_map.h
+++ b/usr.sbin/switchd/ofp_map.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofp_map.h,v 1.8 2016/11/18 16:49:35 reyk Exp $ */
+/* $OpenBSD: ofp_map.h,v 1.9 2016/11/18 16:56:09 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -63,6 +63,7 @@ extern struct constmap ofp_action_map[];
extern struct constmap ofp_flowcmd_map[];
extern struct constmap ofp_flowflag_map[];
extern struct constmap ofp_flowrem_reason_map[];
+extern struct constmap ofp_group_id_map[];
extern struct constmap ofp_errtype_map[];
extern struct constmap ofp_errflowmod_map[];
extern struct constmap ofp_errmatch_map[];