[SSSD] [PATCH] SDAP: Use portable constant as level in setsockopt

Jakub Hrozek jhrozek at redhat.com
Tue Jun 3 11:51:37 UTC 2014


On Tue, Jun 03, 2014 at 11:18:23AM +0200, Jakub Hrozek wrote:
> On Tue, Jun 03, 2014 at 10:28:26AM +0200, Pavel Reichl wrote:
> > On Sat, 2014-05-31 at 18:47 +0200, Lukas Slebodnik wrote:
> > > ehlo,
> > > 
> > > The macros SOL_TCP and IPPROTO_TCP have the same value on linux,
> > > but the first one is not portable.
> > > 
> > > I checked source code of other projects and they use constant IPPROTO_TCP
> > > for seting TCP_NODELAY on tcp socket.
> > > 
> > > c-ares
> > >    ares_process.c:1026:  if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
> > >    ares_process.c-1027-                 (void *)&opt, sizeof(opt)) == -1)
> > >    ares_process.c-1028-    {
> > > 
> > > cups
> > >    http.c-222-
> > >    http.c-223-  val = 1;
> > >    http.c:224:  setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, CUPS_SOCAST &val, sizeof(val));
> > >    http.c-225-
> > > 
> > > audit
> > >    auditd-listen.c-816-
> > >    auditd-listen.c-817-    /* Connection is accepted...start setting it up */
> > >    auditd-listen.c:818:    setsockopt(afd, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof (int));
> > >    auditd-listen.c:819:    setsockopt(afd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof (int));
> > >    auditd-listen.c:820:    setsockopt(afd, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof (int));
> > >    auditd-listen.c-821-    set_close_on_exec (afd);
> > >    auditd-listen.c-822-
> > > 
> > > libtircp
> > >    svc_vc.c-348-   len = 1;
> > >    svc_vc.c-349-   /* XXX fvdl - is this useful? */
> > >    svc_vc.c:350:   setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &len, sizeof (len));
> > >    svc_vc.c-351-}
> > >    svc_vc.c-352-
> > > 
> > > valgrind
> > >    valgrind-di-server.c-1133-
> > >    valgrind-di-server.c-1134-assert(one == 1);
> > >    valgrind-di-server.c:1135:int ret = setsockopt( new_sd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
> > >    valgrind-di-server.c-1136-assert(ret != -1);
> > >    valgrind-di-server.c-1137-
> > > 
> > > openldap
> > >    daemon.c-1918-            /* enable no delay */
> > >    daemon.c-1919-            tmp = 1;
> > >    daemon.c:1920:            rc = setsockopt( s, IPPROTO_TCP, TCP_NODELAY,
> > >    daemon.c-1921-                    (char *)&tmp, sizeof(tmp) );
> > >    daemon.c-1922-            if ( rc == AC_SOCKET_ERROR ) {
> > > 
> > > Simple patch is attached.
> > > 
> > > LS
> > > _______________________________________________
> > > sssd-devel mailing list
> > > sssd-devel at lists.fedorahosted.org
> > > https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
> > 
> > Hello,
> > 
> > patch applies fine, SSSD builds fine and seems to work fine. Internet
> > seems in consensus with the portability argument. 
> > 
> > ACK.  
> 
> Pushed to master:
>     cf901f549abe18f32562cbe1ef7a1ef258edab1a

Pushed to sssd-1-11:
    0690f3222a69607843433e6ad0870af95193801e



More information about the sssd-devel mailing list