parent
916c3744f3
commit
d8f5aacd7f
@ -58,6 +58,7 @@ Broker:
|
||||
- The broker now sends the receive-maximum property for MQTT v5 CONNACKs.
|
||||
- mosquitto_password now forbids the : character. Closes #1833.
|
||||
- Fix `log_timestamp_format` not applying to `log_dest topic`. Closes #1862.
|
||||
- Add the `bridge_max_packet_size` option. Closes #265.
|
||||
|
||||
Client library:
|
||||
- Client no longer generates random client ids for v3.1.1 clients, these are
|
||||
|
@ -1521,6 +1521,20 @@ openssl dhparam -out dhparam.pem 2048</programlisting>
|
||||
<replaceable>true</replaceable>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>bridge_max_packet_size</option> <replaceable>value</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If you wish to restrict the size of messages sent to a
|
||||
remote bridge, use this option. This sets the maximum
|
||||
number of bytes for the total message, including headers
|
||||
and payload. Note that MQTT v5 brokers may provide their
|
||||
own maximum-packet-size property. In this case, the
|
||||
smaller of the two limits will be used. Set to 0 for
|
||||
"unlimited".
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>bridge_outgoing_retain</option> [ true | false ]</term>
|
||||
<listitem>
|
||||
|
@ -786,6 +786,14 @@
|
||||
# all outgoing messages to that bridge, regardless of any other setting.
|
||||
#bridge_outgoing_retain true
|
||||
|
||||
# If you wish to restrict the size of messages sent to a remote bridge, use the
|
||||
# bridge_max_packet_size option. This sets the maximum number of bytes for
|
||||
# the total message, including headers and payload.
|
||||
# Note that MQTT v5 brokers may provide their own maximum-packet-size property.
|
||||
# In this case, the smaller of the two limits will be used.
|
||||
# Set to 0 for "unlimited".
|
||||
#bridge_max_packet_size 0
|
||||
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Certificate based SSL/TLS support
|
||||
|
@ -162,6 +162,7 @@ int bridge__connect_step1(struct mosquitto_db *db, struct mosquitto *context)
|
||||
context->in_packet.payload = NULL;
|
||||
context->ping_t = 0;
|
||||
context->bridge->lazy_reconnect = false;
|
||||
context->maximum_packet_size = context->bridge->maximum_packet_size;
|
||||
bridge__packet_cleanup(context);
|
||||
db__message_reconnect_reset(db, context);
|
||||
|
||||
@ -339,6 +340,7 @@ int bridge__connect(struct mosquitto_db *db, struct mosquitto *context)
|
||||
context->in_packet.payload = NULL;
|
||||
context->ping_t = 0;
|
||||
context->bridge->lazy_reconnect = false;
|
||||
context->maximum_packet_size = context->bridge->maximum_packet_size;
|
||||
bridge__packet_cleanup(context);
|
||||
db__message_reconnect_reset(db, context);
|
||||
|
||||
|
13
src/conf.c
13
src/conf.c
@ -1035,6 +1035,19 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
||||
if(conf__parse_bool(&token, "bridge_require_ocsp", &cur_bridge->tls_ocsp_required, saveptr)) return MOSQ_ERR_INVAL;
|
||||
#else
|
||||
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
||||
#endif
|
||||
}else if(!strcmp(token, "bridge_max_packet_size")){
|
||||
#if defined(WITH_BRIDGE)
|
||||
if(reload) continue; // Bridges not valid for reloading.
|
||||
if(!cur_bridge){
|
||||
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
if(conf__parse_int(&token, "bridge_max_packet_size", &tmp_int, saveptr)) return MOSQ_ERR_INVAL;
|
||||
if(tmp_int < 0) tmp_int = 0;
|
||||
cur_bridge->maximum_packet_size = (uint32_t)tmp_int;
|
||||
#else
|
||||
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
|
||||
#endif
|
||||
}else if(!strcmp(token, "bridge_outgoing_retain")){
|
||||
#if defined(WITH_BRIDGE)
|
||||
|
@ -32,6 +32,7 @@ int handle__connack(struct mosquitto_db *db, struct mosquitto *context)
|
||||
uint8_t connect_acknowledge;
|
||||
uint8_t reason_code;
|
||||
mosquitto_property *properties = NULL;
|
||||
uint32_t maximum_packet_size;
|
||||
|
||||
if(!context){
|
||||
return MOSQ_ERR_INVAL;
|
||||
@ -55,6 +56,15 @@ int handle__connack(struct mosquitto_db *db, struct mosquitto *context)
|
||||
}
|
||||
rc = property__read_all(CMD_CONNACK, &context->in_packet, &properties);
|
||||
if(rc) return rc;
|
||||
|
||||
if(mosquitto_property_read_int32(properties, MQTT_PROP_MAXIMUM_PACKET_SIZE,
|
||||
&maximum_packet_size, false)){
|
||||
|
||||
if(context->maximum_packet_size == 0 || context->maximum_packet_size > maximum_packet_size){
|
||||
context->maximum_packet_size = maximum_packet_size;
|
||||
}
|
||||
}
|
||||
|
||||
mosquitto_property_free_all(&properties);
|
||||
}
|
||||
mosquitto_property_free_all(&properties); /* FIXME - TEMPORARY UNTIL PROPERTIES PROCESSED */
|
||||
|
@ -586,6 +586,7 @@ struct mosquitto__bridge{
|
||||
int backoff_base;
|
||||
int backoff_cap;
|
||||
int threshold;
|
||||
uint32_t maximum_packet_size;
|
||||
bool lazy_reconnect;
|
||||
bool attempt_unsubscribe;
|
||||
bool initial_notification_done;
|
||||
|
Loading…
Reference in New Issue
Block a user