代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/firefox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# HG changeset patch
# User Valentin Gosu <valentin.gosu@gmail.com>
# Date 1604497734 0
# Wed Nov 04 13:48:54 2020 +0000
# Node ID 179e399ac08119ef3da61766c73f265679a6cf51
# Parent 6810172b5a5861dbf847848d0a34f13787c1a6ba
Bug 1672528 - Check IPv4-mapped IPv6 addresses for being local r=dragana,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D95414
diff -r 6810172b5a58 -r 179e399ac081 netwerk/dns/DNS.cpp
--- a/netwerk/dns/DNS.cpp Wed Nov 04 17:16:26 2020 +0000
+++ b/netwerk/dns/DNS.cpp Wed Nov 04 13:48:54 2020 +0000
@@ -183,27 +183,37 @@ bool IsIPAddrV4Mapped(const NetAddr* add
return false;
}
+static bool isLocalIPv4(uint32_t networkEndianIP) {
+ uint32_t addr32 = ntohl(networkEndianIP);
+ if (addr32 >> 24 == 0x0A || // 10/8 prefix (RFC 1918).
+ addr32 >> 20 == 0xAC1 || // 172.16/12 prefix (RFC 1918).
+ addr32 >> 16 == 0xC0A8 || // 192.168/16 prefix (RFC 1918).
+ addr32 >> 16 == 0xA9FE) { // 169.254/16 prefix (Link Local).
+ return true;
+ }
+ return false;
+}
+
bool IsIPAddrLocal(const NetAddr* addr) {
MOZ_ASSERT(addr);
// IPv4 RFC1918 and Link Local Addresses.
if (addr->raw.family == AF_INET) {
- uint32_t addr32 = ntohl(addr->inet.ip);
- if (addr32 >> 24 == 0x0A || // 10/8 prefix (RFC 1918).
- addr32 >> 20 == 0xAC1 || // 172.16/12 prefix (RFC 1918).
- addr32 >> 16 == 0xC0A8 || // 192.168/16 prefix (RFC 1918).
- addr32 >> 16 == 0xA9FE) { // 169.254/16 prefix (Link Local).
- return true;
- }
+ return isLocalIPv4(addr->inet.ip);
}
// IPv6 Unique and Link Local Addresses.
+ // or mapped IPv4 address
if (addr->raw.family == AF_INET6) {
uint16_t addr16 = ntohs(addr->inet6.ip.u16[0]);
if (addr16 >> 9 == 0xfc >> 1 || // fc00::/7 Unique Local Address.
addr16 >> 6 == 0xfe80 >> 6) { // fe80::/10 Link Local Address.
return true;
}
+ if (IPv6ADDR_IS_V4MAPPED(&addr->inet6.ip)) {
+ return isLocalIPv4(IPv6ADDR_V4MAPPED_TO_IPADDR(&addr->inet6.ip));
+ }
}
+
// Not an IPv4/6 local address.
return false;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。