[Oisf-devel] [PATCH 1/2] Add interface setting discovery via ioctl

Eric Leblond eleblond at edenwall.com
Mon Nov 29 14:43:07 UTC 2010


Le lundi 29 novembre 2010 à 15:06 +0100, Victor Julien a écrit :
> Eric Leblond wrote:
> 
> > +int GetIfaceMaxHWHeaderLength(char *pcap_dev)
> > +{
> > +    if ((!strcmp("eth", pcap_dev))
> > +            ||
> > +            (!strcmp("br", pcap_dev))
> > +            ||
> > +            (!strcmp("bond", pcap_dev))
> > +            ||
> > +            (!strcmp("wlan", pcap_dev))
> > +            ||
> > +            (!strcmp("tun", pcap_dev))
> > +            ||
> > +            (!strcmp("tap", pcap_dev))
> > +            ||
> > +            (!strcmp("lo", pcap_dev))
> > +       )
> 
> Shouldn't strncmp be used here? The pcap_dev is unlikely to be just
> "eth", right?

Yes, I should have sleep more this week end ;)

> 
> > +int GetIfaceMTU(char *pcap_dev)
> > +{
> > +#ifdef SIOCGIFMTU
> > +    struct ifreq ifr;
> > +    int fd;
> > +
> > +    (void)strncpy(ifr.ifr_name, pcap_dev, sizeof(ifr.ifr_name));
> 
> Please use strlcpy (from util-strlcpy.h).

OK.

> > +int GetIfaceMTU(char *pcap_dev);
> > +int GetIfaceMaxPayloadSize(char *pcap_dev);
> 
> I'd like a naming like IfaceGetMTU better.

Ok, no pb.

I will soon resubmit a patchset.

What about the previous patchsets ?

BR,

> 
> Thanks Eric.
> 
> Cheers,
> Victor
> 
> 
-- 
Éric Leblond, eleblond at edenwall.com
Téléphone : +33 1 40 24 65 04, Fax : +33 9 57 21 48 75
EdenWall, http://www.edenwall.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Ceci est une partie de message numériquement signée
URL: <http://lists.openinfosecfoundation.org/pipermail/oisf-devel/attachments/20101129/849b8638/attachment.sig>


More information about the Oisf-devel mailing list