From: Maria Matejka Date: Sun, 28 Jan 2024 14:04:45 +0000 (+0100) Subject: Merge commit 'v2.14-95-g6d453c16' into thread-next X-Git-Tag: v3.0.0~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddb4d9a24cc5d79308b12fc3b92b4701d3f54f8e;p=thirdparty%2Fbird.git Merge commit 'v2.14-95-g6d453c16' into thread-next --- ddb4d9a24cc5d79308b12fc3b92b4701d3f54f8e diff --cc proto/bgp/bgp.c index 9de97181a,9d4671afc..49078520b --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@@ -473,11 -375,11 +473,12 @@@ bgp_close_conn(struct bgp_conn *conn conn->keepalive_timer = NULL; rfree(conn->hold_timer); conn->hold_timer = NULL; - + rfree(conn->send_hold_timer); + conn->send_hold_timer = NULL; rfree(conn->tx_ev); conn->tx_ev = NULL; - rfree(conn->sk); + + sk_close(conn->sk); conn->sk = NULL; mb_free(conn->local_open_msg); @@@ -2829,10 -2650,9 +2859,12 @@@ bgp_show_proto_info(struct proto *P tm_remains(p->conn->hold_timer), p->conn->hold_time); cli_msg(-1006, " Keepalive timer: %t/%u", tm_remains(p->conn->keepalive_timer), p->conn->keepalive_time); + cli_msg(-1006, " TX pending: %d bytes%s", + p->conn->sk->tpos - p->conn->sk->ttx, + ev_active(p->conn->tx_ev) ? " (refill scheduled)" : ""); - } + cli_msg(-1006, " Send hold timer: %t/%u", + tm_remains(p->conn->send_hold_timer), p->conn->send_hold_time); + } #if 0 struct bgp_stats *s = &p->stats; diff --cc proto/bgp/bgp.h index 269ce986e,7127bc88a..a6a79801a --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@@ -313,19 -318,9 +316,19 @@@ struct bgp_conn int notify_code, notify_subcode, notify_size; byte *notify_data; - uint hold_time, keepalive_time; /* Times calculated from my and neighbor's requirements */ + uint hold_time, keepalive_time, send_hold_time; /* Times calculated from my and neighbor's requirements */ }; +struct bgp_listen_request { + node n; /* Node in bgp_socket / pending list */ + struct bgp_socket *sock; /* Assigned socket */ + ip_addr addr; + struct iface *iface; + struct iface *vrf; + uint port; + uint flags; +}; + struct bgp_proto { struct proto p; const struct bgp_config *cf; /* Shortcut to BGP configuration */ diff --cc proto/bgp/config.Y index 2358c318c,1173ff060..2ee26919c --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@@ -29,9 -30,9 +29,9 @@@ CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, H GRACEFUL, RESTART, AWARE, CHECK, LINK, PORT, EXTENDED, MESSAGES, SETKEY, STRICT, BIND, CONFEDERATION, MEMBER, MULTICAST, FLOW4, FLOW6, LONG, LIVED, STALE, IMPORT, IBGP, EBGP, MANDATORY, INTERNAL, EXTERNAL, SETS, - DYNAMIC, RANGE, NAME, DIGITS, BGP_AIGP, AIGP, ORIGINATE, COST, ENFORCE, + DYNAMIC, RANGE, NAME, DIGITS, AIGP, ORIGINATE, COST, ENFORCE, FIRST, FREE, VALIDATE, BASE, ROLE, ROLES, PEER, PROVIDER, CUSTOMER, - RS_SERVER, RS_CLIENT, REQUIRE, BGP_OTC, GLOBAL) + RS_SERVER, RS_CLIENT, REQUIRE, BGP_OTC, GLOBAL, SEND) %type bgp_nh %type bgp_afi diff --cc proto/bgp/packets.c index 35ca2dfb8,e8cc47187..180c0b730 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@@ -1044,7 -1047,8 +1049,8 @@@ bgp_rx_open(struct bgp_conn *conn, byt conn->hold_time, conn->keepalive_time, p->remote_as, p->remote_id, conn->as4_session); bgp_schedule_packet(conn, NULL, PKT_KEEPALIVE); - bgp_start_timer(conn->hold_timer, conn->hold_time); - bgp_start_timer(conn->send_hold_timer, conn->send_hold_time); + bgp_start_timer(p, conn->hold_timer, conn->hold_time); ++ bgp_start_timer(p, conn->send_hold_timer, conn->send_hold_time); bgp_conn_enter_openconfirm_state(conn); } @@@ -3035,7 -3066,11 +3041,11 @@@ bgp_send(struct bgp_conn *conn, uint ty put_u16(buf+16, len); buf[18] = type; - return sk_send(sk, len); + int success = sk_send(sk, len); + if (success && ((conn->state == BS_ESTABLISHED) || (conn->state == BS_OPENCONFIRM))) - bgp_start_timer(conn->send_hold_timer, conn->send_hold_time); ++ bgp_start_timer(conn->bgp, conn->send_hold_timer, conn->send_hold_time); + + return success; } /** @@@ -3199,7 -3230,10 +3209,12 @@@ bgp_tx(sock *sk { struct bgp_conn *conn = sk->data; + ASSERT_DIE(birdloop_inside(conn->bgp->p.loop)); ++ + /* Pending message was passed to kernel */ + if ((conn->state == BS_ESTABLISHED) || (conn->state == BS_OPENCONFIRM)) - bgp_start_timer(conn->send_hold_timer, conn->send_hold_time); ++ bgp_start_timer(conn->bgp, conn->send_hold_timer, conn->send_hold_time); + DBG("BGP: TX hook\n"); uint max = 1024; while (--max && (bgp_fire_tx(conn) > 0))