{"record":{"id":"0e28146c6f06fa65","repo":"cilium/cilium","slug":"invalid-mac-address-for-s-w","errorCode":null,"errorMessage":"invalid MAC address for %s: %w","messagePattern":"invalid MAC address for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/endpoint/endpoint.go","lineNumber":714,"sourceCode":"\tep.IPv6 = ipv6\n\n\tep.setState(StateWaitingForIdentity, \"Ingress Endpoint creation\")\n\n\treturn ep, nil\n}\n\n// CreateHostEndpoint creates the endpoint corresponding to the host.\nfunc CreateHostEndpoint(p EndpointParams,\n\tdnsRulesAPI DNSRulesAPI, proxy EndpointProxy,\n\tpolicyDebugLog io.Writer) (*Endpoint, error) {\n\tiface, err := safenetlink.LinkByName(defaults.HostDevice)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thostMAC, err := mac.FromHardwareAddr(iface.Attrs().HardwareAddr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid MAC address for %s: %w\", defaults.HostDevice, err)\n\t}\n\n\tep := createEndpoint(p, dnsRulesAPI, proxy, 0, defaults.HostDevice, policyDebugLog)\n\tep.isHost = true\n\tep.mac = hostMAC\n\tep.nodeMAC = hostMAC\n\tep.ifIndex = iface.Attrs().Index\n\tep.DatapathConfiguration = NewDatapathConfiguration()\n\n\tep.setState(StateWaitingForIdentity, \"Endpoint creation\")\n\n\treturn ep, nil\n}\n\n// GetID returns the endpoint's ID as a 64-bit unsigned integer.\nfunc (e *Endpoint) GetID() uint64 {\n\treturn uint64(e.ID)\n}","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/endpoint/endpoint.go#L696-L732","documentation":"When creating the host endpoint, Cilium reads the hardware (MAC) address of the host device (defaults.HostDevice) via netlink and parses it with mac.FromHardwareAddr. If parsing fails, this error reports an invalid MAC address for the host device, and the host endpoint cannot be created.","triggerScenarios":"iface.Attrs().HardwareAddr is empty, malformed (wrong length, not 6 bytes) or otherwise unparseable — typically because the host device named by --host-device does not exist as expected or is an unusual virtual interface.","commonSituations":"Misconfigured host-device flag pointing to a interface with no MAC; unusual tunnel/bond devices; kernel returning empty HardwareAddr for the device; running in environments with exotic veth setups.","solutions":["Verify the device configured via --host-device exists and has a valid MAC (ip link show <device>).","Ensure the device is a standard Ethernet-like interface; if using a custom device, confirm its HardwareAddr is 6 bytes.","Correct the --host-device flag to point at the intended interface (e.g. eth0 or the chosen datapath device).","Restart cilium-agent after fixing the device configuration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"iface, err := netlink.LinkByName(hostDevice)\nif err != nil {\n    return fmt.Errorf(\"host device %s not found\", hostDevice)\n}\nmac := iface.Attrs().HardwareAddr\nif len(mac) != 6 {\n    return fmt.Errorf(\"host device %s has invalid MAC length %d\", hostDevice, len(mac))\n}","typeGuard":"func validMAC(a net.HardwareAddr) bool { return len(a) == 6 }","tryCatchPattern":"if _, err := CreateHostEndpoint(...); err != nil {\n    if strings.Contains(err.Error(), \"invalid MAC address\") {\n        log.Printf(\"host device %s lacks a valid MAC; choose a standard Ethernet device\", defaults.HostDevice)\n    }\n}","preventionTips":["Verify with `ip link show <device>` that the chosen host device has a valid 6-byte MAC.","Point --host-device at a standard veth/physical NIC, not exotic tunnel interfaces.","Validate node networking in CI before deploying Cilium.","Re-check device selection after node network reconfiguration."],"tags":["netlink","mac-address","host-endpoint","cilium"],"backgroundTag":"invalid-mac-address","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}