Lines Matching refs:mask

154     int mask = parseSubnetMask(subnet, famHint);  in add()  local
155 if (!isMaskValid(mask, famHint)) { in add()
172 if (famHint == IP_FAM::V4 && !populateV4Mask(mask, pre)) { in add()
173 mLastErr = "Failed to populate IPv4 Mask(" + std::to_string(mask) in add()
176 } else if (!populateV6Mask(mask, pre)) { in add()
177 mLastErr = "Failed to populate IPv6 Mask(" + std::to_string(mask) in add()
213 bool PrefixParser::splitIntoAddrAndMask(string in, string &addr, string &mask) { in splitIntoAddrAndMask() argument
231 mask = in.substr(pos + 1); in splitIntoAddrAndMask()
237 mask = ""; in splitIntoAddrAndMask()
240 mask = ""; in splitIntoAddrAndMask()
246 mask = ""; in splitIntoAddrAndMask()
315 bool PrefixParser::populateV4Mask(int mask, Prefix &out) { in populateV4Mask() argument
316 if (mask < 0 || mask > 32) in populateV4Mask()
318 out.v4Mask = createMask(mask); in populateV4Mask()
322 bool PrefixParser::populateV6Mask(int mask, Prefix &out) { in populateV6Mask() argument
323 if (mask < 0 || mask > 128) in populateV6Mask()
327 out.v6Mask[i] = createMask(mask); in populateV6Mask()
328 mask = (mask > 32) ? mask - 32 : 0; in populateV6Mask()
334 uint32_t PrefixParser::createMask(int mask) { in createMask() argument
337 if (mask >= 32) { in createMask()
343 if (i < mask) in createMask()
373 bool PrefixParser::isMaskValid(int mask, IP_FAM fam) { in isMaskValid() argument
374 if (mask < 0) { in isMaskValid()
375 mLastErr = "Failed parse subnet mask(" + std::to_string(mask) + ")"; in isMaskValid()
377 } else if (mask == 0) { in isMaskValid()
378 mLastErr = "Subnet mask cannot be 0(" + std::to_string(mask) + ")"; in isMaskValid()
380 } else if (fam == IP_FAM::V4 && mask > 32) { in isMaskValid()
382 + std::to_string(mask) + ")"; in isMaskValid()
384 } else if (fam == IP_FAM::V6 && mask > 128) { in isMaskValid()
386 + std::to_string(mask) + ")"; in isMaskValid()