Skip to content

Commit d6c5594

Browse files
committed
Added new vflow attribute VFLOW_ATTRIBUTE_ACTIVE_TLS_ORDINAL and used it in control connectors and listeners
1 parent ad9cc94 commit d6c5594

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

include/qpid/dispatch/vanflow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ typedef enum vflow_attribute {
143143

144144
VFLOW_ATTRIBUTE_ERROR_LISTENER_SIDE = 64, // String
145145
VFLOW_ATTRIBUTE_ERROR_CONNECTOR_SIDE = 65, // String
146+
VFLOW_ATTRIBUTE_ACTIVE_TLS_ORDINAL = 66 // uint The SSL Profile ordinal field that is currently in operation
146147
} vflow_attribute_t;
147148
// clang-format on
148149

src/adaptors/amqp/qd_connector.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ void qd_connector_add_connection(qd_connector_t *connector, qd_connection_t *ctx
486486
void qd_connector_add_link(qd_connector_t *connector)
487487
{
488488
if (!connector->is_data_connector) {
489+
if (connector->vflow_record && connector->ctor_config->tls_config) {
490+
// connector->ctor_config->tls_ordinal is set in the handle_connector_ssl_profile_mgmt_update() callback
491+
vflow_set_uint64(connector->vflow_record, VFLOW_ATTRIBUTE_ACTIVE_TLS_ORDINAL, connector->ctor_config->tls_ordinal);
492+
}
489493
vflow_set_string(connector->vflow_record, VFLOW_ATTRIBUTE_OPER_STATUS, "up");
490494
vflow_set_timestamp_now(connector->vflow_record, VFLOW_ATTRIBUTE_UP_TIMESTAMP);
491495
connector->oper_status_down = false;
@@ -611,7 +615,6 @@ static void handle_connector_ssl_profile_mgmt_update(const qd_tls_config_t *conf
611615
}
612616

613617
// Create a new set of connectors (and their associated connections) that will use the updated TLS credentials.
614-
615618
ctor_config->tls_ordinal = new_ordinal;
616619

617620
if (qd_connector_config_create_connectors(ctor_config) != QD_ERROR_NONE) {

src/adaptors/amqp/qd_listener.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ void qd_listener_add_link(qd_listener_t *li)
302302
if (!!li->vflow_record) {
303303
uint32_t count = sys_atomic_inc(&li->connection_count) + 1;
304304
vflow_set_uint64(li->vflow_record, VFLOW_ATTRIBUTE_LINK_COUNT, count);
305+
if (li->tls_config && li->vflow_record) {
306+
vflow_set_uint64(li->vflow_record, VFLOW_ATTRIBUTE_ACTIVE_TLS_ORDINAL, li->tls_ordinal);
307+
}
305308
}
306309
}
307310

@@ -369,11 +372,12 @@ static void expired_ordinal_connection_scrubber(qd_connection_t *qd_conn, void *
369372
//
370373
static void handle_listener_ssl_profile_mgmt_update(const qd_tls_config_t *config, void *context)
371374
{
375+
uint64_t new_ordinal = qd_tls_config_get_ordinal(config);
372376
uint64_t new_oldest_ordinal = qd_tls_config_get_oldest_valid_ordinal(config);
373377
qd_listener_t *li = (qd_listener_t *) context;
378+
li->tls_ordinal = new_ordinal;
374379

375380
// destroy all connections whose connectors use an expired TLS ordinal:
376-
377381
if (new_oldest_ordinal > li->tls_oldest_valid_ordinal) {
378382

379383
qd_log(LOG_SERVER, QD_LOG_DEBUG,

src/vanflow.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static uint8_t valid_attribute_types[] = {
224224
ATTR_UCOUNT, ATTR_STRING, ATTR_STRING, ATTR_UINT,
225225
ATTR_UINT, ATTR_UCOUNT, ATTR_UCOUNT, ATTR_UINT,
226226
ATTR_REF, ATTR_UINT, ATTR_STRING, ATTR_STRING,
227-
ATTR_STRING, ATTR_STRING,
227+
ATTR_STRING, ATTR_STRING, ATTR_UINT
228228
};
229229

230230
/**
@@ -1042,6 +1042,7 @@ static const char *_vflow_attribute_name(const vflow_attribute_data_t *data)
10421042
case VFLOW_ATTRIBUTE_PROXY_PORT : return "proxyPort";
10431043
case VFLOW_ATTRIBUTE_ERROR_LISTENER_SIDE : return "errorListenerSide";
10441044
case VFLOW_ATTRIBUTE_ERROR_CONNECTOR_SIDE : return "errorConnectorSide";
1045+
case VFLOW_ATTRIBUTE_ACTIVE_TLS_ORDINAL : return "activeTlsOrdinal";
10451046
}
10461047
return "UNKNOWN";
10471048
}

0 commit comments

Comments
 (0)