Commit 687ac23
committed
Prefer AF_INET results on IPv4-only systems per @thomasvincent suggestion.
On IPv4-only systems, getaddrinfo() can still return AF_INET6 mapped
addresses (e.g. ::ffff:127.0.0.1). The code would format these as
udp6:[addr] peername that Net-SNMP cannot connect to.
When IPv6 is not explicitly requested (no bracket notation), prefer
AF_INET results. If no suitable address is found, fall back to the
original hostname and let Net-SNMP resolve it itself, matching the
behavior of snmprealwalk and other Net-SNMP CLI tools.1 parent e7dcd6a commit 687ac23
1 file changed
+15
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
889 | 893 | | |
890 | 894 | | |
891 | 895 | | |
| |||
896 | 900 | | |
897 | 901 | | |
898 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
899 | 910 | | |
900 | 911 | | |
901 | 912 | | |
| |||
910 | 921 | | |
911 | 922 | | |
912 | 923 | | |
913 | | - | |
914 | | - | |
915 | | - | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
916 | 928 | | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | 929 | | |
921 | 930 | | |
922 | 931 | | |
| |||
0 commit comments