MCPcopy Create free account
hub / github.com/apache/trafficserver / ats_is_ip_linklocal

Function ats_is_ip_linklocal

include/tscore/ink_inet.h:766–780  ·  view source on GitHub ↗

Check for Link Local. @return @true if @a ip is link local.

Source from the content-addressed store, hash-verified

764/// Check for Link Local.
765/// @return @true if @a ip is link local.
766inline bool
767ats_is_ip_linklocal(sockaddr const *ip)
768{
769 bool zret = false;
770 if (ats_is_ip4(ip)) {
771 in_addr_t a = ats_ip4_addr_cast(ip);
772 zret = ((a & htonl(0xFFFF0000)) == htonl(0xA9FE0000)) // 169.254.0.0/16
773 ;
774 } else if (ats_is_ip6(ip)) {
775 in6_addr a = ats_ip6_addr_cast(ip);
776 zret = ((a.s6_addr[0] == 0xFE) && ((a.s6_addr[1] & 0xC0) == 0x80)) // fe80::/10
777 ;
778 }
779 return zret;
780}
781
782/// Check for Link Local.
783/// @return @true if @a ip is link local.

Callers 2

MachineMethod · 0.85
ats_ip_getbestaddrinfoFunction · 0.85

Calls 2

ats_is_ip4Function · 0.85
ats_is_ip6Function · 0.85

Tested by

no test coverage detected