TE
ТехЭхо
ГлавнаяТоп за 24 часаНовейшиеЛучшиеВопросыПоказатьВакансии
GitHubTwitter
Главная

ТехЭхо

Платформа технологических новостей, созданная с использованием Next.js, предоставляющая глобальные технологические новости и обсуждения.

GitHubTwitter

Главная

ГлавнаяНовейшиеЛучшиеВопросыПоказатьВакансии

Ресурсы

HackerNews APIОригинальный HackerNewsNext.js

© 2025 ТехЭхо. Все права защищены.

eBPF Mystery: When is IPv4 not IPv4? When it's pretending to be IPv6

93 балловавтор: tanelpoder2 дня назад

10 comments

zzq10152 дня назад
For Linux, there&#x27;s a kernel setting for that.<p>Just run<p><pre><code> sysctl -w net.ipv6.bindv6only=1 </code></pre> so IPv6 will not include IPv4-mapped addresses.<p><a href="https:&#x2F;&#x2F;www.kernel.org&#x2F;doc&#x2F;Documentation&#x2F;networking&#x2F;ip-sysctl.txt" rel="nofollow">https:&#x2F;&#x2F;www.kernel.org&#x2F;doc&#x2F;Documentation&#x2F;networking&#x2F;ip-sysct...</a>
评论 #43943179 未加载
评论 #43935037 未加载
评论 #43935504 未加载
smitty1e2 дня назад
In a similar fashion, I once saw a python script that called out to a one-page C program that read a .csv dump (probably from SQLServer) and blew away the upper byte of each character, demoting it to ASCII.<p>Once I understood what was afoot, I was sad that someone had worked so hard when python&#x27;s open() call supports an &#x27;encoding&#x27; argument for just these occasions.
评论 #43933969 未加载
评论 #43934221 未加载
IcePic2 дня назад
I think OpenBSD (and other OSes) that do not allow v4 on v6 sockets might be on to something. It was felt convenient for application programmers to only have to listen to one socket for two protocols, but then code after needs to make very sure they know how to handle both families in the correct way for logging and so on, and now much later on it confuses someone that has to dig very deep into why the v4-box talks v4 without using v4.<p>Could be an indication that in the long run, just forcing applications that need both protocols to have separation so you are sure of what they are doing was the correct choice.
评论 #43935445 未加载
评论 #43935513 未加载
degamad2 дня назад
I think of that as the opposite - an IPv6 socket pretending to be IPv4 in order to route to an IPv4 endpoint.
评论 #43935409 未加载
brewmarche1 день назад
You need to be a bit careful with terminology, IPv4-compatible and IPv4-mapped are different, i.e. ::&#x2F;96 vs. ::ffff:0:0&#x2F;96.<p>The former (compatible) are not in use anymore, they were specified in an old tunnelling RFC. The latter (mapped) are used for sockets that bind to both IPv4 and IPv6.<p>There are even more ways to include IPv4 addresses in IPv6 ones (NAT64, 6to4, ...)
Almondsetat2 дня назад
&gt;I thought I must have this wrong, surely you can’t just smash an ipv4 address in ipv6 field and magic happens?! Nope, didn’t have it wrong, that’s what happens. Linux supports this, and will go on to route the request as IPv4.<p>I mean... it&#x27;s literally one of the officially defined unicast IPv6 address types. If you ever read the Wikipedia page to learn about what link-local, global unicast, etc. addresses are you surely would have seen it.
评论 #43936749 未加载
dilfish2 дня назад
I learnt this when using net.ListenTCP in Go, if you use lsof to show the network type, it would be IPv6. But it could also handle IPv4 requests.
nikanjоколо 17 часов назад
Still waiting for that bug that was solved by using ipv6, not caused by ipv6
imoverclocked2 дня назад
If you think that&#x27;s wild, just wait until you learn about 6to4 [1] (not to be confused with 6over4 [2] ...)<p>TL;DR: Given a globally unique IPv4 address, you can create automatic tunneling IPv6 networks with the IPv4 address embedded into the IPv6 address space.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;6to4" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;6to4</a><p>[2] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;6over4" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;6over4</a>
评论 #43934925 未加载
评论 #43934567 未加载
gitroom2 дня назад
pretty cool seeing all the stuff people do to make networks talk, honestly makes me wonder - you think stuff like this sticks around because of habit or just taking shortcuts sometimes