X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fstp.c;h=78dacb38870f075757f3cb12dc3b3c89e39a8a36;hb=79f108b14e7944ddc4669e9c03fc34b40a3a2288;hp=afe77d0824c0757e06ac183b8f2f8fe05b384521;hpb=8917f72cbb04fb32dc29f93475bcd2de3011d442;p=sliver-openvswitch.git diff --git a/lib/stp.c b/lib/stp.c index afe77d082..78dacb388 100644 --- a/lib/stp.c +++ b/lib/stp.c @@ -684,6 +684,15 @@ stp_learn_in_state(enum stp_state state) return (state & (STP_DISABLED | STP_LEARNING | STP_FORWARDING)) != 0; } +/* Returns true if 'state' is one in which rx&tx bpdu should be done on + * on a port, false otherwise. */ +bool +stp_listen_in_state(enum stp_state state) +{ + return (state & + (STP_LISTENING | STP_LEARNING | STP_FORWARDING)) != 0; +} + /* Returns the name for the given 'role' (for use in debugging and log * messages). */ const char * @@ -1528,7 +1537,7 @@ stp_send_bpdu(struct stp_port *p, const void *bpdu, size_t bpdu_size) pkt = ofpbuf_new(ETH_HEADER_LEN + LLC_HEADER_LEN + bpdu_size); pkt->l2 = eth = ofpbuf_put_zeros(pkt, sizeof *eth); llc = ofpbuf_put_zeros(pkt, sizeof *llc); - pkt->l3 = ofpbuf_put(pkt, bpdu, bpdu_size); + ofpbuf_set_l3(pkt, ofpbuf_put(pkt, bpdu, bpdu_size)); /* 802.2 header. */ memcpy(eth->eth_dst, eth_addr_stp, ETH_ADDR_LEN);