[tarantool-patches] Re: [PATCH 4/6] swim: wrap sio_strfaddr()

Konstantin Osipov kostja at tarantool.org
Thu Apr 25 13:34:40 MSK 2019


* Vladislav Shpilevoy <v.shpilevoy at tarantool.org> [19/04/25 00:46]:
> > This is minor, but I would make sio_strfaddr() use the same set of
> > buffers as provided by tt_static_buf() instead, with a static
> > assert that the buffer size is large enough.
> 
> As I said, the tt_static_buf is not big enough. SIO uses NI_MAXHOST
> constant which on Linux is 1025 > size of tt_static_buf.
> 
> http://man7.org/linux/man-pages/man3/getnameinfo.3.html
> 
> If you still think we will not break anything, I can do that. Just
> confirm that you are sure.
> 
> It will not eliminate swim_inaddr_str() though, because most of
> the problems were about huge cast to 'const struct sockaddr *'
> and passing sizeof(struct sockaddr_in) each time - it made code
> unreadable.

I don't have a strong opinion either way, but the length problem
could be fixed by increasing tt_static_buf() size, and adding a
static assert that it's greater than NI_MAXHOST.

It's OK to keep swim_inaddr_str() wrapper.

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list