diff --git a/etc/emqx.conf b/etc/emqx.conf index 14414b220..182a2f9da 100644 --- a/etc/emqx.conf +++ b/etc/emqx.conf @@ -542,6 +542,11 @@ mqtt.shared_subscription = true ## Value: true | false mqtt.ignore_loop_deliver = false +## Whether to parse the MQTT frame in strict mode +## +## Value: true | false +mqtt.strict_mode = false + ##-------------------------------------------------------------------- ## Zones ##-------------------------------------------------------------------- @@ -751,6 +756,11 @@ zone.external.use_username_as_clientid = false ## Value: true | false zone.external.ignore_loop_deliver = false +## Whether to parse the MQTT frame in strict mode +## +## Value: true | false +zone.external.strict_mode = false + ##-------------------------------------------------------------------- ## Internal Zone @@ -832,6 +842,11 @@ zone.internal.use_username_as_clientid = false ## Value: true | false zone.internal.ignore_loop_deliver = false +## Whether to parse the MQTT frame in strict mode +## +## Value: true | false +zone.internal.strict_mode = false + ##-------------------------------------------------------------------- ## Listeners ##-------------------------------------------------------------------- diff --git a/priv/emqx.schema b/priv/emqx.schema index 6ac622ea7..f37e809e8 100644 --- a/priv/emqx.schema +++ b/priv/emqx.schema @@ -715,6 +715,12 @@ end}. {datatype, {enum, [true, false]}} ]}. +%% @doc Whether to parse the MQTT frame in strict mode +{mapping, "mqtt.strict_mode", "emqx.strict_mode", [ + {default, false}, + {datatype, {enum, [true, false]}} +]}. + %%-------------------------------------------------------------------- %% Zones %%-------------------------------------------------------------------- @@ -931,14 +937,14 @@ end}. {datatype, {enum, [true, false]}} ]}. +%% @doc Whether to parse the MQTT frame in strict mode +{mapping, "zone.$name.strict_mode", "emqx.zones", [ + {default, false}, + {datatype, {enum, [true, false]}} +]}. + {translation, "emqx.zones", fun(Conf) -> - Mapping = fun("retain_available", Val) -> - {retain_available, Val}; - ("wildcard_subscription", Val) -> - {wildcard_subscription, Val}; - ("shared_subscription", Val) -> - {shared_subscription, Val}; - ("publish_limit", Val) -> + Mapping = fun("publish_limit", Val) -> [L, D] = string:tokens(Val, ", "), Limit = list_to_integer(L), Duration = case cuttlefish_duration:parse(D, s) of @@ -1000,8 +1006,6 @@ end}. end, #{}, string:tokens(Val, ",")), {mqueue_priorities, MqueuePriorities} end; - ("mountpoint", Val) -> - {mountpoint, iolist_to_binary(Val)}; (Opt, Val) -> {list_to_atom(Opt), Val} end, diff --git a/src/emqx_zone.erl b/src/emqx_zone.erl index 591531927..2fdacfea6 100644 --- a/src/emqx_zone.erl +++ b/src/emqx_zone.erl @@ -141,7 +141,7 @@ mqtt_frame_options(Zone) -> -spec(mqtt_strict_mode(zone()) -> boolean()). mqtt_strict_mode(Zone) -> - get_env(Zone, mqtt_strict_mode, false). + get_env(Zone, strict_mode, false). -spec(max_packet_size(zone()) -> integer()). max_packet_size(Zone) ->