dhcp4d: ensure MQTT topic names are valid UTF-8
https://twitter.com/zekjur/status/1347295676909158400
This commit is contained in:
parent
c30bf38438
commit
3834acfa2b
@ -416,7 +416,9 @@ func newSrv(permDir string) (*srv, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
identifier := latest.Hostname
|
// MQTT requires valid UTF-8 and some brokers don’t cope well with
|
||||||
|
// invalid UTF-8: https://github.com/fhmq/hmq/issues/104
|
||||||
|
identifier := strings.ToValidUTF8(latest.Hostname, "")
|
||||||
if identifier == "" {
|
if identifier == "" {
|
||||||
identifier = latest.HardwareAddr
|
identifier = latest.HardwareAddr
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user