Re: [PATCH lksctp-tools 0/4] lksctp-tools: replace use of deprecated gethostbyname with getaddrinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 4, 2021 at 7:29 PM Xin Long <lucien.xin@xxxxxxxxx> wrote:
>
> This patchset is simply to replace use of deprecated gethostbyname
> with getaddrinfo in myftp, sctp_xconnect, sctp_test and sctp_darn.
There are three ways to use this function in this patchset:

a. get IPv4 addresses by a hostname:

               hints.ai_family = AF_INET;
               hints.ai_protocol = IPPROTO_SCTP;
               getaddrinfo(remote_host, NULL, &hints, &rp)

b. get IPv6 addresses by a hostname:

               hints.ai_family = AF_INET6;
               hints.ai_protocol = IPPROTO_SCTP;
               getaddrinfo(remote_host, NULL, &hints, &rp)

c. get IPv4 and IPv6 addresses by a hostname:

               hints.ai_family = AF_UNSPEC;
               hints.ai_protocol = IPPROTO_SCTP;
               getaddrinfo(remote_host, NULL, &hints, &rp)

Note ai_protocol = IPPROTO_SCTP is necessary, especially for case c.
Otherwise, it will return many addresses with different protocol(TCP, UDP...).

>
> Xin Long (4):
>   myftp: replace use of deprecated gethostbyname with getaddrinfo
>   sctp_xconnect: replace use of deprecated gethostbyname with
>     getaddrinfo
>   sctp_test: replace use of deprecated gethostbyname with getaddrinfo
>   sctp_darn: replace use of deprecated gethostbyname with getaddrinfo
>
>  configure.ac             |   2 +-
>  src/apps/myftp.c         |  40 +++----
>  src/apps/sctp_darn.c     | 246 +++++++++++----------------------------
>  src/apps/sctp_test.c     |  63 +++-------
>  src/apps/sctp_xconnect.c |  72 +++++-------
>  5 files changed, 137 insertions(+), 286 deletions(-)
>
> --
> 2.27.0
>



[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     SCTP

  Powered by Linux