{"record":{"id":"f7edff067f47f0a6","repo":"micro/go-micro","slug":"mdns-received-query-with-non-zero-opcode-v-v","errorCode":null,"errorMessage":"mdns: received query with non-zero Opcode %v: %v","messagePattern":"mdns: received query with non-zero Opcode (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/util/mdns/server.go","lineNumber":226,"sourceCode":"\tif err := msg.Unpack(packet); err != nil {\n\t\tlog.Errorf(\"[ERR] mdns: Failed to unpack packet: %v\", err)\n\t\treturn err\n\t}\n\t// TODO: This is a bit of a hack\n\t// We decided to ignore some mDNS answers for the time being\n\t// See: https://tools.ietf.org/html/rfc6762#section-7.2\n\tmsg.Truncated = false\n\treturn s.handleQuery(&msg, from)\n}\n\n// handleQuery is used to handle an incoming query.\nfunc (s *Server) handleQuery(query *dns.Msg, from net.Addr) error {\n\tif query.Opcode != dns.OpcodeQuery {\n\t\t// \"In both multicast query and multicast response messages, the OPCODE MUST\n\t\t// be zero on transmission (only standard queries are currently supported\n\t\t// over multicast).  Multicast DNS messages received with an OPCODE other\n\t\t// than zero MUST be silently ignored.\"  Note: OpcodeQuery == 0\n\t\treturn fmt.Errorf(\"mdns: received query with non-zero Opcode %v: %v\", query.Opcode, *query)\n\t}\n\tif query.Rcode != 0 {\n\t\t// \"In both multicast query and multicast response messages, the Response\n\t\t// Code MUST be zero on transmission.  Multicast DNS messages received with\n\t\t// non-zero Response Codes MUST be silently ignored.\"\n\t\treturn fmt.Errorf(\"mdns: received query with non-zero Rcode %v: %v\", query.Rcode, *query)\n\t}\n\n\t// TODO(reddaly): Handle \"TC (Truncated) Bit\":\n\t//    In query messages, if the TC bit is set, it means that additional\n\t//    Known-Answer records may be following shortly.  A responder SHOULD\n\t//    record this fact, and wait for those additional Known-Answer records,\n\t//    before deciding whether to respond.  If the TC bit is clear, it means\n\t//    that the querying host has no additional Known Answers.\n\tif query.Truncated {\n\t\treturn fmt.Errorf(\"[ERR] mdns: support for DNS requests with high truncated bit not implemented: %v\", *query)\n\t}\n","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/internal/util/mdns/server.go#L208-L244","documentation":"Per RFC 6762, mDNS query messages must have Opcode zero (standard queries only). handleQuery rejects any received query whose Opcode differs from dns.OpcodeQuery. Although framed as an error, the RFC says such packets should be silently ignored, so callers typically treat this as a drop condition.","triggerScenarios":"parsePacket receiving a DNS query packet over multicast with Opcode != 0 (e.g. reverse-lookup/iquery opcodes from non-mDNS DNS traffic).","commonSituations":"Non-mDNS DNS traffic leaking onto the multicast group; misconfigured devices sending legacy DNS queries to 224.0.0.251:5353.","solutions":["Ignore/drop the packet — this is expected behavior for non-standard opcodes per RFC 6762","Identify the offending sender from the log (packet content is included) and reconfigure it","Ensure your network segment isn't mixing unicast DNS traffic into the mDNS multicast group"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := srv.handleQuery(query, from); err != nil {\n    if strings.Contains(err.Error(), \"non-zero Opcode\") {\n        // RFC 6762: silently ignore — log at debug and continue serving\n        log.Debugf(\"ignoring non-mDNS opcode from %v\", from)\n        return nil\n    }\n    return err\n}","preventionTips":["Treat this error as a packet-drop signal, not a fatal condition","Keep mDNS traffic isolated from legacy unicast DNS traffic","Log the sender address so misbehaving devices can be identified"],"tags":["mdns","dns","protocol"],"backgroundTag":"unsupported-dns-opcode","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}