The 'minor' member of struct dpif is used for two different purposes:
for printing in log messages and for encapsulating in NetFlow messages.
The needs in each case are different, so we should break up these uses.
This commit does half of that, by introducing a new function to retrieve
NetFlow ids and using it where appropriate.
{
poll_fd_wait(dpif->fd, POLLIN);
}
{
poll_fd_wait(dpif->fd, POLLIN);
}
+
+void
+dpif_get_netflow_ids(const struct dpif *dpif,
+ uint8_t *engine_type, uint8_t *engine_id)
+{
+ *engine_type = *engine_id = dpif->minor;
+}
\f
struct dpifmon {
struct dpif dpif;
\f
struct dpifmon {
struct dpif dpif;
+void dpif_get_netflow_ids(const struct dpif *,
+ uint8_t *engine_type, uint8_t *engine_id);
uint64_t dpid;
struct iface *local_iface = NULL;
const char *devname;
uint64_t dpid;
struct iface *local_iface = NULL;
const char *devname;
- uint8_t engine_type = br->dpif.minor;
- uint8_t engine_id = br->dpif.minor;
+ uint8_t engine_type, engine_id;
bool add_id_to_iface = false;
struct svec nf_hosts;
bool add_id_to_iface = false;
struct svec nf_hosts;
ofproto_set_datapath_id(br->ofproto, dpid);
/* Set NetFlow configuration on this bridge. */
ofproto_set_datapath_id(br->ofproto, dpid);
/* Set NetFlow configuration on this bridge. */
+ dpif_get_netflow_ids(&br->dpif, &engine_type, &engine_id);
if (cfg_has("netflow.%s.engine-type", br->name)) {
engine_type = cfg_get_int(0, "netflow.%s.engine-type",
br->name);
if (cfg_has("netflow.%s.engine-type", br->name)) {
engine_type = cfg_get_int(0, "netflow.%s.engine-type",
br->name);