[PATCH 1/2] Decode setsockopt() multicast arguments

Dmitry V. Levin ldv at altlinux.org
Tue May 26 14:26:29 UTC 2015


On Sat, Feb 07, 2015 at 08:17:46PM +0300, Dmitry V. Levin wrote:
> On Sat, Feb 07, 2015 at 06:05:56PM +0100, Ben Noordhuis wrote:
> > On Sat, Feb 7, 2015 at 12:55 AM, Dmitry V. Levin wrote:
> > > On Thu, Feb 05, 2015 at 07:28:45PM +0100, Ben Noordhuis wrote:
> > >> +#ifdef IP_ADD_MEMBERSHIP
> > >> +static void
> > >> +print_mreq(struct tcb *tcp, long addr, int len)
> > >> +{
> > >> +     struct ip_mreq mreq;
> > >> +     if (len == sizeof(mreq) && umove(tcp, addr, &mreq) == 0) {
> > >> +             tprints("{imr_multiaddr=inet_addr(");
> > >> +             print_quoted_string(inet_ntoa(mreq.imr_multiaddr),
> > >> +                                 16, QUOTE_0_TERMINATED);
> > >> +             tprints("), imr_interface=inet_addr(");
> > >> +             print_quoted_string(inet_ntoa(mreq.imr_interface),
> > >> +                                 16, QUOTE_0_TERMINATED);
> > >> +             tprints(")}");
> > >> +     }
> > >> +     else {
> > >> +             printstr(tcp, addr, len);
> > >> +     }
> > >> +}
> > >
> > > Is there any use to print the address with printstr if length is not
> > > sizeof(ip_mreq) or umove has failed?  Other sockopt parsers in such
> > > situations just print the address in hex.
> > 
> > Printing the raw data helps troubleshooting more than printing a
> > memory address does, IMO.  printstr() is also what print_getsockopt()
> > and print_setsockopt() seem to fall back to.  Let me know what you
> > think is preferable.
> 
> Agreed, lets fall back to printstr() in case of length mismatch.
> 
> > I agree that there is no point calling printstr() when umove() fails,
> > I'll update that.

Are you still working on that update?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150526/08866804/attachment.bin>


More information about the Strace-devel mailing list