Re: [PATCH ulogd2 2/3] gprint: fix comma after ip addresses

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

 



On 2025-02-08, at 22:20:32 +0100, Pablo Neira Ayuso wrote:
> On Sat, Feb 08, 2025 at 02:49:49PM +0100, corubba wrote:
> > Gone missing in f04bf679.
> 
> ulogd2$ git show f04bf679
> fatal: ambiguous argument 'f04bf679': unknown revision or path not in the working tree.
> 
> ???

f04bf6794d11 ("gprint, oprint: use inet_ntop to format ip addresses").
It includes this change:

-                       ret = snprintf(buf+size, rem, "%u.%u.%u.%u,",
-                               NIPQUAD(key->u.value.ui32));
-                       if (ret < 0)
+                       ipv4addr.s_addr = key->u.value.ui32;
+                       if (!inet_ntop(AF_INET, &ipv4addr, buf + size, rem))
                                break;
+                       ret = strlen(buf + size);
+

The snprintf appends a comma after the IP address.

> > Signed-off-by: Corubba Smith <corubba@xxxxxx>
> > ---
> >  output/ulogd_output_GPRINT.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/output/ulogd_output_GPRINT.c b/output/ulogd_output_GPRINT.c
> > index 37829fa..d95ca9d 100644
> > --- a/output/ulogd_output_GPRINT.c
> > +++ b/output/ulogd_output_GPRINT.c
> > @@ -179,9 +179,15 @@ static int gprint_interp(struct ulogd_pluginstance *upi)
> >  			if (!inet_ntop(family, addr, buf + size, rem))
> >  				break;
> >  			ret = strlen(buf + size);
> > +			rem -= ret;
> > +			size += ret;
> > 
> > +			ret = snprintf(buf+size, rem, ",");
> > +			if (ret < 0)
> > +				break;
> >  			rem -= ret;
> >  			size += ret;
> > +
> >  			break;
> >  		}
> >  		default:
> > --
> > 2.48.1
> > 
> > 
> 

J.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux