struct dp_netdev_actions {
/* These members are immutable: they do not change during the struct's
* lifetime. */
- struct nlattr *actions; /* Sequence of OVS_ACTION_ATTR_* attributes. */
unsigned int size; /* Size of 'actions', in bytes. */
+ struct nlattr actions[]; /* Sequence of OVS_ACTION_ATTR_* attributes. */
};
struct dp_netdev_actions *dp_netdev_actions_create(const struct nlattr *,
}
\f
-/* Creates and returns a new 'struct dp_netdev_actions', with a reference count
- * of 1, whose actions are a copy of from the 'ofpacts_len' bytes of
- * 'ofpacts'. */
+/* Creates and returns a new 'struct dp_netdev_actions', whose actions are
+ * a copy of the 'ofpacts_len' bytes of 'ofpacts'. */
struct dp_netdev_actions *
dp_netdev_actions_create(const struct nlattr *actions, size_t size)
{
struct dp_netdev_actions *netdev_actions;
- netdev_actions = xmalloc(sizeof *netdev_actions);
- netdev_actions->actions = xmemdup(actions, size);
+ netdev_actions = xmalloc(sizeof *netdev_actions + size);
+ memcpy(netdev_actions->actions, actions, size);
netdev_actions->size = size;
return netdev_actions;
static void
dp_netdev_actions_free(struct dp_netdev_actions *actions)
{
- free(actions->actions);
free(actions);
}
\f