{"record":{"id":"4f691fdea8deacc7","repo":"micro/go-micro","slug":"mdns-received-query-with-non-zero-rcode-v-v","errorCode":null,"errorMessage":"mdns: received query with non-zero Rcode %v: %v","messagePattern":"mdns: received query with non-zero Rcode (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/util/mdns/server.go","lineNumber":232,"sourceCode":"\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\n\tvar unicastAnswer, multicastAnswer []dns.RR\n\n\t// Handle each question\n\tfor _, q := range query.Question {\n\t\tmrecs, urecs := s.handleQuestion(q)\n\t\tmulticastAnswer = append(multicastAnswer, mrecs...)","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/internal/util/mdns/server.go#L214-L250","documentation":"mDNS messages must carry Rcode zero (NOERROR) on both queries and responses; non-zero response codes must be silently ignored per RFC 6762. handleQuery returns this error when a received query has a non-zero Rcode field.","triggerScenarios":"parsePacket delivering a query packet whose dns.Msg Rcode is non-zero (e.g. FormErr/NotImp encoded by a broken sender).","commonSituations":"Malformed or hostile packets on the local network; non-mDNS clients sending error-flagged DNS messages to the multicast address.","solutions":["Treat as ignorable per RFC 6762 and skip the packet","Log and inspect the included packet dump to identify the sender","Segment the network or filter multicast traffic from non-mDNS sources"],"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 Rcode\") {\n        log.Debugf(\"ignoring query with Rcode!=0 from %v\", from)\n        return nil\n    }\n    return err\n}","preventionTips":["Ignore per RFC 6762 rather than crashing the packet loop","Capture the packet dump included in the error to trace the source host","Filter multicast traffic from non-mDNS clients on shared networks"],"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"}