Retrieve IPv4 and IPv6 nameservers programmatically

前端 未结 1 587
庸人自扰
庸人自扰 2021-01-26 03:32

I\'m trying to use libresolv to read both the IPv4 and IPv6 nameservers in my /etc/resolv.conf file:

# Dynamic resolv.conf(5) file for glibc resolve         


        
1条回答
  •  再見小時候
    2021-01-26 04:29

    You really should not access the _u._ext parts of the resolver state, they are an internal implementation detail. The nscount6 member is currently unused and always zero. It had to be kept to avoid changing the ABI as the result of struct offset/size changes.

    If you need the nameserver list, you should parse /etc/resolv.conf yourself. Note that eventually, glibc will also support more than three name servers, and those extra resolvers will not be reflected in the public resolver state.

    0 讨论(0)
提交回复
热议问题