- if (ping_af != NULL) {
- int af = PING_DEF_AF;
- if (strncmp(ping_af, "any", 3) == 0) {
- af = AF_UNSPEC;
- } else if (strncmp(ping_af, "ipv4", 4) == 0) {
- af = AF_INET;
- } else if (strncmp(ping_af, "ipv6", 4) == 0) {
- af = AF_INET6;
- } else {
- ERROR("ping plugin: Bad address family: %s. Using default.", ping_af);
- }
- if (ping_setopt(pingobj, PING_OPT_AF, &af) != 0)
+ if (ping_af != PING_DEF_AF) {
+ if (ping_setopt(pingobj, PING_OPT_AF, &ping_af) != 0)