diff --git a/ChangeLog.txt b/ChangeLog.txt index e1a261ff..b3e338b1 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -15,6 +15,10 @@ ## Behaviour changes +- max_packet_size now defaults to 2,000,000 bytes instead of the 256MB MQTT + limit. If you are using payloads that will result in a packet larger than + this, you need to manually set the option to a value that suits your + application. - acl_file and password_file will produce an error on invalid input when reloading the config, causing the broker to quit. diff --git a/man/mosquitto.conf.5.xml b/man/mosquitto.conf.5.xml index b937e195..de7b4d98 100644 --- a/man/mosquitto.conf.5.xml +++ b/man/mosquitto.conf.5.xml @@ -833,7 +833,11 @@ log_timestamp_format %Y-%m-%dT%H:%M:%S clients regardless of the protocol version they are using, but v3.1.1 and earlier clients will of course not have received the maximum packet size information. - Defaults to no limit. + + + Defaults to 2000000 bytes since 2.1. Earlier versions + defaulted to no limit. + This option applies to all clients, not just those using MQTT v5, but it is not possible to notify clients diff --git a/src/conf.c b/src/conf.c index 45e2d56f..f17faa51 100644 --- a/src/conf.c +++ b/src/conf.c @@ -335,7 +335,7 @@ static void config__init_reload(struct mosquitto__config *config) config->global_max_connections = -1; config->log_timestamp_format = NULL; config->max_keepalive = 0; - config->max_packet_size = 0; + config->max_packet_size = 2000000; config->max_inflight_messages = 20; config->max_queued_messages = 1000; config->max_inflight_bytes = 0; diff --git a/test/broker/01-connect-auto-id.py b/test/broker/01-connect-auto-id.py index 8dbb3f90..e917a2b5 100755 --- a/test/broker/01-connect-auto-id.py +++ b/test/broker/01-connect-auto-id.py @@ -65,7 +65,7 @@ def do_test(config_func, client_port, auto_id): # Remove the "xxxx" part - this means the front part of the packet # is correct (so remaining length etc. is correct), but we don't # need to match against the random id. - connack_packet = connack_packet[:-39] + connack_packet = connack_packet[:-44] broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port1, use_conf=True) diff --git a/test/broker/01-connect-zero-length-id.py b/test/broker/01-connect-zero-length-id.py index 1ab163ae..e29e54a0 100755 --- a/test/broker/01-connect-zero-length-id.py +++ b/test/broker/01-connect-zero-length-id.py @@ -40,7 +40,7 @@ def do_test(per_listener, proto_ver, clean_start, allow_zero, client_port, expec # Remove the "xxxx" part - this means the front part of the packet # is correct (so remaining length etc. is correct), but we don't # need to match against the random id. - connack_packet = connack_packet[:-39] + connack_packet = connack_packet[:-44] broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port1, use_conf=True) diff --git a/test/broker/03-publish-bad-flags.py b/test/broker/03-publish-bad-flags.py index c9f86513..e70125c4 100755 --- a/test/broker/03-publish-bad-flags.py +++ b/test/broker/03-publish-bad-flags.py @@ -23,6 +23,7 @@ def do_test(publish_packet, reason_code, error_string): connack_props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) connack_props += mqtt5_props.gen_byte_prop(mqtt5_props.RETAIN_AVAILABLE, 0) + connack_props += mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) connack_props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) connack_props += mqtt5_props.gen_byte_prop(mqtt5_props.MAXIMUM_QOS, 1) diff --git a/test/broker/03-publish-qos1-max-inflight-expire.py b/test/broker/03-publish-qos1-max-inflight-expire.py index 3078053d..34225066 100755 --- a/test/broker/03-publish-qos1-max-inflight-expire.py +++ b/test/broker/03-publish-qos1-max-inflight-expire.py @@ -18,6 +18,7 @@ def do_test(proto_ver): sub_connect_packet = mosq_test.gen_connect("sub", properties=properties, proto_ver=proto_ver, clean_session=False) properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \ + + mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \ + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1) sub_connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False) sub_connack_packet2 = mosq_test.gen_connack(rc=0, flags=1, proto_ver=proto_ver, properties=properties, property_helper=False) @@ -28,6 +29,7 @@ def do_test(proto_ver): connect_packet = mosq_test.gen_connect("pub-qos1-test", proto_ver=proto_ver) properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \ + + mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \ + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1) connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False) diff --git a/test/broker/03-publish-qos1-max-inflight.py b/test/broker/03-publish-qos1-max-inflight.py index 7f78929c..3da6e335 100755 --- a/test/broker/03-publish-qos1-max-inflight.py +++ b/test/broker/03-publish-qos1-max-inflight.py @@ -15,6 +15,7 @@ def do_test(proto_ver): rc = 1 connect_packet = mosq_test.gen_connect("pub-qos1-test", proto_ver=proto_ver) properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \ + + mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \ + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1) connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False) diff --git a/test/broker/03-publish-qos2-max-inflight.py b/test/broker/03-publish-qos2-max-inflight.py index 37ac179d..6a31d97f 100755 --- a/test/broker/03-publish-qos2-max-inflight.py +++ b/test/broker/03-publish-qos2-max-inflight.py @@ -20,6 +20,7 @@ def do_test(proto_ver): rc = 1 connect_packet = mosq_test.gen_connect("pub-qos2-test", proto_ver=proto_ver) properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \ + + mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \ + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 1) connack_packet = mosq_test.gen_connack(rc=0, proto_ver=proto_ver, properties=properties, property_helper=False) diff --git a/test/broker/09-extended-auth-reauth.py b/test/broker/09-extended-auth-reauth.py index 66500c8a..dff2df7d 100755 --- a/test/broker/09-extended-auth-reauth.py +++ b/test/broker/09-extended-auth-reauth.py @@ -18,10 +18,8 @@ props = mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat") props += mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_DATA, "repeat") connect_packet = mosq_test.gen_connect("client-params-test", proto_ver=5, properties=props) -props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) -props += mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat") -props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) -connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False) +props = mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat") +connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props) # Reauthentication fails props = mqtt5_props.gen_string_prop(mqtt5_props.AUTHENTICATION_METHOD, "repeat") diff --git a/test/broker/12-prop-maximum-packet-size-broker.py b/test/broker/12-prop-maximum-packet-size-broker.py index 72cd382d..9df91b68 100755 --- a/test/broker/12-prop-maximum-packet-size-broker.py +++ b/test/broker/12-prop-maximum-packet-size-broker.py @@ -17,8 +17,10 @@ write_config(conf_file, port) rc = 1 connect_packet = mosq_test.gen_connect("12-max-packet-broker", proto_ver=5) -props = mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 40) -connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props) +props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) +props += mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 40) +props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) +connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False) publish_packet = mosq_test.gen_publish("12/max/packet/size/broker/test/topic", qos=0, payload="0123456789012345678901234567890", proto_ver=5) disconnect_packet = mosq_test.gen_disconnect(reason_code=149, proto_ver=5) diff --git a/test/broker/12-prop-server-keepalive.py b/test/broker/12-prop-server-keepalive.py index bc889b8c..e189fd11 100755 --- a/test/broker/12-prop-server-keepalive.py +++ b/test/broker/12-prop-server-keepalive.py @@ -24,6 +24,7 @@ connect_packet = mosq_test.gen_connect("12-server-keepalive", proto_ver=5, keepa props = mqtt5_props.gen_uint16_prop(mqtt5_props.SERVER_KEEP_ALIVE, 60) \ + mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \ + + mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \ + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False) diff --git a/test/broker/data/CONNECT.json b/test/broker/data/CONNECT.json index 2c8e6da4..63ce1d02 100644 --- a/test/broker/data/CONNECT.json +++ b/test/broker/data/CONNECT.json @@ -145,14 +145,14 @@ "tests": [ { "name": "10 ok ", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r14 s4 'MQTT' 05 02 k10 v0 s1 'p'", "comment":"minimal valid CONNECT"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "10 remaining length 5 bytes", "msgs":[ {"type":"send", "payload":"10 r268435456 s4 'MQTT' 05 02 k10 s1 'p'", "comment":"CONNECT"} ]}, { "name": "10 Username flag 1 ok", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r17 s4 'MQTT' 05 82 k10 v0 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "10 Client ID with 0x0000", "msgs": [ {"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 v0 s5 746F700000"}, @@ -219,7 +219,7 @@ ]}, { "name": "10 Will flag 1 ok", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r21 s4 'MQTT' 05 06 k10 v0 s1 'p' 00 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "tiny max packet", "msgs":[{"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 27 L2 s1 'p'"}]} ] @@ -242,7 +242,7 @@ "tests": [ { "name": "session-expiry-interval (four byte integer)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 11 L1 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*session-expiry-interval (four byte integer)", "msgs":[ {"type":"send", "payload":"10 r24 s4 'MQTT' 05 02 k10 0A 11 L1 11 L1 s1 'p'"}, @@ -255,7 +255,7 @@ { "name": "receive-maximum (two byte integer)", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 21 0101 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "receive-maximum (two byte integer) 0 value", "msgs": [ {"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 21 0000 s1 'p'"}, @@ -272,7 +272,7 @@ { "name": "maximum-packet-size (four byte integer)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 27 10000001 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*maximum-packet-size (four byte integer)", "msgs":[ {"type":"send", "payload":"10 r24 s4 'MQTT' 05 02 k10 0A 27 10000001 27 10000001 s1 'p'"}, @@ -288,16 +288,16 @@ ]}, { "name": "maximum-packet-size (four byte integer) FFFFFFFF value", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 27 FFFFFFFF s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "topic-alias-maximum (two byte integer)", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 22 0101 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "topic-alias-maximum (two byte integer) 0 value", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r17 s4 'MQTT' 05 02 k10 03 22 0000 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*topic-alias-maximum (two byte integer)", "msgs": [ {"type":"send", "payload":"10 r20 s4 'MQTT' 05 02 k10 06 22 0101 22 0101 s1 'p'"}, @@ -310,7 +310,7 @@ { "name": "request-response-information (byte)", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r16 s4 'MQTT' 05 02 k10 02 19 01 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*request-response-information (byte)", "msgs": [ {"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 04 19 01 19 01 s1 'p'"}, @@ -327,7 +327,7 @@ { "name": "request-problem-information (byte)", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r16 s4 'MQTT' 05 02 k10 02 17 01 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*request-problem-information (byte)", "msgs": [ {"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 04 17 01 17 01 s1 'p'"}, @@ -344,11 +344,11 @@ { "name": "user-property", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r21 s4 'MQTT' 05 02 k10 07 26 s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*user-property", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r28 s4 'MQTT' 05 02 k10 0E 26 s1 'p' s1 'p' 26 s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property missing value", "msgs": [ {"type":"send", "payload":"10 r18 s4 'MQTT' 05 02 k10 04 26 s1 'p' s1 'p'"}, @@ -360,15 +360,15 @@ ]}, { "name": "user-property empty key", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r20 s4 'MQTT' 05 02 k10 06 26 0000 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property empty value", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r20 s4 'MQTT' 05 02 k10 06 26 s1 'p' 0000 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property empty key,value", "expect_disconnect":false, "msgs": [ {"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 26 0000 0000 s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "authentication-method (UTF-8 string) missing", "msgs": [ @@ -705,7 +705,7 @@ "tests": [ { "name": "payload-format-indicator (byte)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r23 s4 'MQTT' 05 06 k10 v0 s1 'p' 02 01 01 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "payload-format-indicator (byte) missing", "msgs":[ {"type":"send", "payload":"10 r22 s4 'MQTT' 05 06 k10 v0 s1 'p' 01 01 s1 'p' s1 'p'"}, @@ -718,7 +718,7 @@ { "name": "message-expiry-interval (four byte integer)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r26 s4 'MQTT' 05 06 k10 v0 s1 'p' 05 02 L1 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*message-expiry-interval (four byte integer)", "msgs":[ {"type":"send", "payload":"10 r31 s4 'MQTT' 05 06 k10 v0 s1 'p' 0A 02 L1 02 L1 s1 'p' s1 'p'"}, @@ -731,7 +731,7 @@ { "name": "will-delay-interval (four byte integer)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r26 s4 'MQTT' 05 06 k10 v0 s1 'p' 05 18 L1 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "will-delay-interval (four byte integer)", "msgs":[ {"type":"send", "payload":"10 r31 s4 'MQTT' 05 06 k10 v0 s1 'p' 0A 18 L1 18 L1 s1 'p' s1 'p'"}, @@ -744,7 +744,7 @@ { "name": "content-type (UTF-8 string)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 03 s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*content-type (UTF-8 string)", "msgs":[ {"type":"send", "payload":"10 r29 s4 'MQTT' 05 06 k10 v0 s1 'p' 08 03 s1 'p' 03 s1 'p' s1 'p' s1 'p'"}, @@ -756,12 +756,12 @@ ]}, { "name": "content-type (UTF-8 string) empty", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r24 s4 'MQTT' 05 06 k10 v0 s1 'p' 03 03 0000 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "response-topic (UTF-8 string)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 08 s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*response-topic (UTF-8 string)", "msgs":[ {"type":"send", "payload":"10 r29 s4 'MQTT' 05 06 k10 v0 s1 'p' 08 08 s1 'p' 08 s1 'p' s1 'p' s1 'p'"}, @@ -778,7 +778,7 @@ { "name": "correlation-data (binary)", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 09 s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*correlation-data (binary)", "msgs":[ {"type":"send", "payload":"10 r29 s4 'MQTT' 05 06 k10 v0 s1 'p' 08 09 s1 'p' 09 s1 'p' s1 'p' s1 'p'"}, @@ -790,16 +790,16 @@ ]}, { "name": "correlation-data (binary) empty", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r24 s4 'MQTT' 05 06 k10 v0 s1 'p' 03 09 0000 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r28 s4 'MQTT' 05 06 k10 v0 s1 'p' 07 26 s1 'p' s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "2*user-property", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r35 s4 'MQTT' 05 06 k10 v0 s1 'p' 0E 26 s1 'p' s1 'p' 26 s1 'p' s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property missing value", "msgs":[ {"type":"send", "payload":"10 r25 s4 'MQTT' 05 06 k10 v0 s1 'p' 04 26 s1 'p' s1 'p' s1 'p'"}, @@ -811,15 +811,15 @@ ]}, { "name": "user-property empty key", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r27 s4 'MQTT' 05 06 k10 v0 s1 'p' 06 26 0000 s1 'p' s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property empty value", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r27 s4 'MQTT' 05 06 k10 v0 s1 'p' 06 26 s1 'p' 0000 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]}, { "name": "user-property empty key,value", "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r26 s4 'MQTT' 05 06 k10 v0 s1 'p' 05 26 0000 0000 s1 'p' s1 'p'"}, - {"type":"recv", "payload":"20 r9 00 00 06 22 H10 21 H20", "comment": "CONNACK"} + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"} ]} ] }, diff --git a/test/broker/data/DISCONNECT.json b/test/broker/data/DISCONNECT.json index 55a438c5..5d381f97 100644 --- a/test/broker/data/DISCONNECT.json +++ b/test/broker/data/DISCONNECT.json @@ -96,7 +96,7 @@ ]}, { "name": "E0 non-zero session expiry", "connect":false, "msgs": [ {"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 05 11 L0 s1 'p'", "comment":"CONNECT with session expiry=0"}, - {"type":"recv", "payload":"20 r9 00000622000A210014", "comment": "CONNACK"}, + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}, {"type":"send", "payload":"E0 r7 00 05 11 L1"}, {"type":"recv", "payload":"E0 r1 82"} ]} diff --git a/test/broker/data/PUBLISH.json b/test/broker/data/PUBLISH.json index b692e036..1045778e 100644 --- a/test/broker/data/PUBLISH.json +++ b/test/broker/data/PUBLISH.json @@ -154,7 +154,7 @@ "tests": [ { "name": "maximum packet size", "connect":false, "expect_disconnect":false, "msgs":[ {"type":"send", "payload":"10 r19 s4 'MQTT' 05 02 k10 v5 2700000014 s1 'p'", "comment":"CONNECT with max-packet-size 20"}, - {"type":"recv", "payload":"20 r9 00 00 06 22000A210014", "comment": "CONNACK"}, + {"type":"recv", "payload":"20 r14 00000B 22 H10 27 L2000000 21 H20", "comment": "CONNACK"}, {"type":"send", "payload":"82 r11 m1234 v0 s5 'topic' 00", "comment":"SUBSCRIBE topic"}, {"type":"recv", "payload":"90 r4 m1234 v0 00", "comment":"SUBACK"}, {"type":"send", "payload":"30 r22 s5 'topic' v0 'payloadpayload'", "comment":"PUBLISH with size > 20"}, diff --git a/test/lib/11-prop-oversize-packet.py b/test/lib/11-prop-oversize-packet.py index 7ac1ff07..f8f56697 100755 --- a/test/lib/11-prop-oversize-packet.py +++ b/test/lib/11-prop-oversize-packet.py @@ -8,8 +8,10 @@ from mosq_test_helper import * def do_test(conn, data): connect_packet = mosq_test.gen_connect("publish-qos0-test", proto_ver=5) - props = mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 30) - connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props) + props = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) + props += mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 30) + props += mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) + connack_packet = mosq_test.gen_connack(rc=0, proto_ver=5, properties=props, property_helper=False) bad_publish_packet = mosq_test.gen_publish("pub/test", qos=0, payload="0123456789012345678", proto_ver=5) publish_packet = mosq_test.gen_publish("pub/test", qos=0, payload="012345678901234567", proto_ver=5) diff --git a/test/mosq_test.py b/test/mosq_test.py index 54d98e31..1ffc3b00 100644 --- a/test/mosq_test.py +++ b/test/mosq_test.py @@ -676,7 +676,9 @@ def gen_connack(flags=0, rc=0, proto_ver=4, properties=b"", property_helper=True if property_helper == True: if properties is not None: properties = mqtt5_props.gen_uint16_prop(mqtt5_props.TOPIC_ALIAS_MAXIMUM, 10) \ - + properties + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) + + properties \ + + mqtt5_props.gen_uint32_prop(mqtt5_props.MAXIMUM_PACKET_SIZE, 2000000) \ + + mqtt5_props.gen_uint16_prop(mqtt5_props.RECEIVE_MAXIMUM, 20) else: properties = b"" properties = mqtt5_props.prop_finalise(properties)