struct ovs_list msg_list; /* List of 'struct bundle_message's */
};
-static inline struct ofp_bundle_entry *ofp_bundle_entry_alloc(
- enum ofptype type, const struct ofp_header *oh);
static inline void ofp_bundle_entry_free(struct ofp_bundle_entry *);
enum ofperr ofp_bundle_open(struct ofconn *, uint32_t id, uint16_t flags,
void ofp_bundle_remove__(struct ofconn *, struct ofp_bundle *);
\f
-static inline struct ofp_bundle_entry *
-ofp_bundle_entry_alloc(enum ofptype type, const struct ofp_header *oh)
-{
- struct ofp_bundle_entry *entry = xmalloc(sizeof *entry);
-
- entry->type = type;
- entry->msg = xmemdup(oh, ntohs(oh->length));
-
- return entry;
-}
-
static inline void
ofp_bundle_entry_free(struct ofp_bundle_entry *entry)
{
struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
enum ofperr error;
struct ofputil_bundle_add_msg badd;
- struct ofp_bundle_entry *bmsg;
enum ofptype type;
error = reject_slave_controller(ofconn);
return error;
}
- bmsg = ofp_bundle_entry_alloc(type, badd.msg);
+ /* Allocate bundle entry and decode the embedded message. */
+ struct ofp_bundle_entry *bmsg = xmalloc(sizeof *bmsg);
struct ofpbuf ofpacts;
uint64_t ofpacts_stub[1024 / 8];
} else {
OVS_NOT_REACHED();
}
-
ofpbuf_uninit(&ofpacts);
-
- if (!error) {
- error = ofp_bundle_add_message(ofconn, badd.bundle_id, badd.flags,
- bmsg, oh);
+ if (error) {
+ free(bmsg);
+ return error;
}
+ /* Now that the embedded message has been successfully decoded, finish up
+ * initializing the bundle entry. */
+ bmsg->type = type;
+ bmsg->msg = xmemdup(oh, ntohs(oh->length));
+
+ /* Add bundle entry to bundle. */
+ error = ofp_bundle_add_message(ofconn, badd.bundle_id, badd.flags,
+ bmsg, oh);
if (error) {
ofp_bundle_entry_free(bmsg);
}
-
return error;
}