-/* Copyright (c) 2013 Nicira, Inc.
+/* Copyright (c) 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "hmap.h"
#include "list.h"
#include "netdev.h"
-#include "netlink.h"
#include "odp-util.h"
#include "ofpbuf.h"
#include "ovs-thread.h"
ovs_mutex_lock(&mutex);
hmap_remove(all_bfds, &bfd->node);
netdev_close(bfd->netdev);
- ovs_refcount_destroy(&bfd->ref_cnt);
free(bfd->name);
free(bfd);
ovs_mutex_unlock(&mutex);
enum flags flags;
uint8_t version;
struct msg *msg;
+ const uint8_t *l7 = ofpbuf_get_udp_payload(p);
+
+ if (!l7) {
+ return; /* No UDP payload. */
+ }
/* This function is designed to follow section RFC 5880 6.8.6 closely. */
goto out;
}
- msg = ofpbuf_at(p, (uint8_t *)p->l7 - (uint8_t *)p->data, BFD_PACKET_LEN);
+ msg = ofpbuf_at(p, l7 - (uint8_t *)ofpbuf_data(p), BFD_PACKET_LEN);
if (!msg) {
VLOG_INFO_RL(&rl, "%s: Received too-short BFD control message (only "
"%"PRIdPTR" bytes long, at least %d required).",
- bfd->name, (uint8_t *) ofpbuf_tail(p) - (uint8_t *) p->l7,
+ bfd->name, (uint8_t *) ofpbuf_tail(p) - l7,
BFD_PACKET_LEN);
goto out;
}