ipToHex converts an IPv4 address to a uint32 in network byte order. SECURITY: This function only outputs hex digits - no user input passes through.
(ip net.IP)
| 665 | // ipToHex converts an IPv4 address to a uint32 in network byte order. |
| 666 | // SECURITY: This function only outputs hex digits - no user input passes through. |
| 667 | func ipToHex(ip net.IP) uint32 { |
| 668 | ipv4 := ip.To4() |
| 669 | if ipv4 == nil { |
| 670 | return 0 |
| 671 | } |
| 672 | // Network byte order (big endian) - this matches how IPs are stored in IP headers |
| 673 | return binary.BigEndian.Uint32(ipv4) |
| 674 | } |
| 675 | |
| 676 | // DropReasonsCommand returns the command to fetch SKB drop reason enum from kernel. |
| 677 | // The enum values are kernel-version specific and must be read at runtime. |
no outgoing calls