diff options
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index 4b17454e8..339572e44 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1255,6 +1255,17 @@ parse_addr_and_port_range(const char *s, uint32_t *addr_out, return -1; } +int +tor_inet_ntoa(struct in_addr *in, char *buf, size_t buf_len) +{ + uint32_t a = ntohl(in->s_addr); + return tor_snprintf(buf, buf_len, "%d.%d.%d.%d", + (int)(uint8_t)((a>>24)&0xff), + (int)(uint8_t)((a>>16)&0xff), + (int)(uint8_t)((a>>8 )&0xff), + (int)(uint8_t)((a )&0xff)); +} + /* ===== * Process helpers * ===== */ |