Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netpfil/ipfw/nat64/nat64_translate.h
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | if (addr->s6_addr16[0] == 0 || /* 0000::/8 Reserved by IETF */ | ||||
return (1); | return (1); | ||||
return (0); | return (0); | ||||
} | } | ||||
static inline int | static inline int | ||||
nat64_check_ip4(in_addr_t ia) | nat64_check_ip4(in_addr_t ia) | ||||
{ | { | ||||
/* IN_LOOPBACK */ | /* These checks are ordered from most likely to least */ | ||||
if ((ia & htonl(0xff000000)) == htonl(0x7f000000)) | if (IN_MULTICAST(ntohl(ia)) || IN_LOOPBACK(ntohl(ia)) || | ||||
return (1); | IN_LINKLOCAL(ntohl(ia)) || IN_EXPERIMENTAL(ntohl(ia))) | ||||
/* IN_LINKLOCAL */ | |||||
if ((ia & htonl(0xffff0000)) == htonl(0xa9fe0000)) | |||||
return (1); | |||||
/* IN_MULTICAST & IN_EXPERIMENTAL */ | |||||
if ((ia & htonl(0xe0000000)) == htonl(0xe0000000)) | |||||
return (1); | return (1); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* Well-known prefix 64:ff9b::/96 */ | /* Well-known prefix 64:ff9b::/96 */ | ||||
#define IPV6_ADDR_INT32_WKPFX htonl(0x64ff9b) | #define IPV6_ADDR_INT32_WKPFX htonl(0x64ff9b) | ||||
#define IN6_IS_ADDR_WKPFX(a) \ | #define IN6_IS_ADDR_WKPFX(a) \ | ||||
((a)->s6_addr32[0] == IPV6_ADDR_INT32_WKPFX && \ | ((a)->s6_addr32[0] == IPV6_ADDR_INT32_WKPFX && \ | ||||
Show All 21 Lines |