[PATCH] bsd/ntpq: Use the correct address length
Kinsey Moore
kinsey.moore at oarcorp.com
Fri Sep 22 00:26:16 UTC 2023
Yes, sorry about that. I apparently haven't added the subject tweak to this
repo yet.
Thanks,
Kinsey
On Thu, Sep 21, 2023 at 7:02 PM Chris Johns <chrisj at rtems.org> wrote:
> I assume this is in the network services repo?
>
> OK and thanks
>
> Chris
>
> On 22/9/2023 4:38 am, Kinsey Moore wrote:
> > lwIP includes more than the bare address structures in its accounting of
> > the total addrinfo struct size. Ensure that lwIP gets the correct
> > address size.
> > ---
> > bsd/freebsd/contrib/ntp/ntpq/ntpq.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/bsd/freebsd/contrib/ntp/ntpq/ntpq.c
> b/bsd/freebsd/contrib/ntp/ntpq/ntpq.c
> > index 1cea922..0ea6c08 100644
> > --- a/bsd/freebsd/contrib/ntp/ntpq/ntpq.c
> > +++ b/bsd/freebsd/contrib/ntp/ntpq/ntpq.c
> > @@ -828,6 +828,14 @@ openhost(
> > #ifdef SYS_VXWORKS
> > (connect(sockfd, (struct sockaddr *)&hostaddr,
> > sizeof(hostaddr)) == -1)
> > +#elif defined(__rtems__)
> > + /*
> > + * lwIP's ai_addrlen covers the entire struct which includes
> > + * padding for extra data and is not accurate for calls which
> > + * validate the size of the address structure. Use sa_len
> instead
> > + */
> > + (connect(sockfd, (struct sockaddr *)ai->ai_addr,
> > + ai->ai_addr->sa_len) == -1)
> > #else
> > (connect(sockfd, (struct sockaddr *)ai->ai_addr,
> > ai->ai_addrlen) == -1)
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230921/9d000fb3/attachment.htm>
More information about the devel
mailing list