MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipfw_check_nat64prefix

Function ipfw_check_nat64prefix

tools/ipfw/nat64stl.c:89–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 (a)->__u6_addr.__u6_addr32[1] == 0 && \
88 (a)->__u6_addr.__u6_addr32[2] == 0)
89int
90ipfw_check_nat64prefix(const struct in6_addr *prefix, int length)
91{
92
93 switch (length) {
94 case 32:
95 case 40:
96 case 48:
97 case 56:
98 case 64:
99 /* Well-known prefix has 96 prefix length */
100 if (IN6_IS_ADDR_WKPFX(prefix))
101 return (EINVAL);
102 /* FALLTHROUGH */
103 case 96:
104 /* Bits 64 to 71 must be set to zero */
105 if (prefix->__u6_addr.__u6_addr8[8] != 0)
106 return (EINVAL);
107 /* XXX: looks incorrect */
108 if (IN6_IS_ADDR_MULTICAST(prefix) ||
109 IN6_IS_ADDR_UNSPECIFIED(prefix) ||
110 IN6_IS_ADDR_LOOPBACK(prefix))
111 return (EINVAL);
112 return (0);
113 }
114 return (EINVAL);
115}
116
117static struct _s_x nat64statscmds[] = {
118 { "reset", TOK_RESET },

Callers 4

nat64clat_createFunction · 0.85
nat64clat_configFunction · 0.85
nat64lsn_createFunction · 0.85
nat64stl_createFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected