uint32_t rmt_disc; /* bfd.RemoteDiscr. */
+ uint8_t eth_dst[ETH_ADDR_LEN];/* Ethernet destination address. */
+ bool eth_dst_set; /* 'eth_dst' set through database. */
+
uint16_t udp_src; /* UDP source port. */
/* All timers in milliseconds. */
long long int min_tx, min_rx;
bool cpath_down;
+ const char *hwaddr;
+ uint8_t ea[ETH_ADDR_LEN];
if (ovsthread_once_start(&once)) {
unixctl_command_register("bfd/show", "[interface]", 0, 1,
bfd->udp_src = (bfd->udp_src % 16384) + 49152;
bfd_set_state(bfd, STATE_DOWN, DIAG_NONE);
+
+ memcpy(bfd->eth_dst, eth_addr_bfd, ETH_ADDR_LEN);
}
atomic_store(&bfd->check_tnl_key,
}
bfd_poll(bfd);
}
+
+ hwaddr = smap_get(cfg, "bfd_dst_mac");
+ if (hwaddr && eth_addr_from_string(hwaddr, ea) && !eth_addr_is_zero(ea)) {
+ memcpy(bfd->eth_dst, ea, ETH_ADDR_LEN);
+ bfd->eth_dst_set = true;
+ } else if (bfd->eth_dst_set) {
+ memcpy(bfd->eth_dst, eth_addr_bfd, ETH_ADDR_LEN);
+ bfd->eth_dst_set = false;
+ }
+
ovs_mutex_unlock(&mutex);
return bfd;
}
ofpbuf_reserve(p, 2); /* Properly align after the ethernet header. */
eth = ofpbuf_put_uninit(p, sizeof *eth);
- memcpy(eth->eth_dst, eth_addr_broadcast, ETH_ADDR_LEN);
memcpy(eth->eth_src, eth_src, ETH_ADDR_LEN);
+ memcpy(eth->eth_dst, bfd->eth_dst, ETH_ADDR_LEN);
eth->eth_type = htons(ETH_TYPE_IP);
ip = ofpbuf_put_zeros(p, sizeof *ip);
struct flow_wildcards *wc)
{
bool check_tnl_key;
+ memset(&wc->masks.dl_dst, 0xff, sizeof wc->masks.dl_dst);
+ if (bfd->eth_dst_set && memcmp(bfd->eth_dst, flow->dl_dst, ETH_ADDR_LEN)) {
+ return false;
+ }
memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
}
return (flow->dl_type == htons(ETH_TYPE_IP)
&& flow->nw_proto == IPPROTO_UDP
- && flow->tp_dst == htons(3784)
+ && flow->tp_dst == htons(BFD_DEST_PORT)
&& (check_tnl_key || flow->tunnel.tun_id == htonll(0)));
}
static const uint8_t eth_addr_lacp[ETH_ADDR_LEN] OVS_UNUSED
= { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 };
+static const uint8_t eth_addr_bfd[ETH_ADDR_LEN] OVS_UNUSED
+ = { 0x00, 0x23, 0x20, 0x00, 0x00, 0x01 };
+
static inline bool eth_addr_is_broadcast(const uint8_t ea[6])
{
return (ea[0] & ea[1] & ea[2] & ea[3] & ea[4] & ea[5]) == 0xff;
<code>false</code>.
</column>
+ <column name="bfd" key="bfd_dst_mac">
+ An Ethernet address in the form
+ <var>xx</var>:<var>xx</var>:<var>xx</var>:<var>xx</var>:<var>xx</var>:<var>xx</var>
+ to set the destination mac address of the bfd packet. If this
+ field is set, it is assumed that all the bfd packets destined to this
+ interface also has the same destination mac address. If not set, a
+ default value of <code>00:23:20:00:00:01</code> is used.
+ </column>
+
<column name="bfd_status" key="state"
type='{"type": "string",
"enum": ["set", ["admin_down", "down", "init", "up"]]}'>