[syslog-ng] TOS value updating from afinet_setup_socket

Thu Jun 11 16:02:02 CEST 2015

Dear All,

                I am facing issue in updating TOS value using setsockopt in the function afinet_setup_socket.

                //syslog_ng_dscp_val = 40;

                setsockopt(fd, SOL_IP, IP_TOS, &syslog_ng_dscp_val, sizeof(syslog_ng_dscp_val));
below is the function definition.

I am not getting any print messages. I think this function is not being called. Please suggest me how to update the TOS value.

I am waiting for your responses please.

static gboolean
afinet_setup_socket(gint fd, GSockAddr *addr, InetSocketOptions *sock_options, AFSocketDirection dir)
  gint off = 0;

  if (!afsocket_setup_socket(fd, &sock_options->super, dir))
    return FALSE;

  switch (addr->sa.sa_family)
    case AF_INET:
        struct ip_mreq mreq;
            if (dir & AFSOCKET_DIR_RECV)
                memset(&mreq, 0, sizeof(mreq));
                setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
            if (dir & AFSOCKET_DIR_SEND)
                        setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &sock_options->ttl, sizeof(sock_options->ttl));
                if (sock_options->ttl && (dir & AFSOCKET_DIR_SEND))
                        setsockopt(fd, SOL_IP, IP_TTL, &sock_options->ttl, sizeof(sock_options->ttl));
        //setsockopt(fd, SOL_IP, IP_TOS, &syslog_ng_dscp_val, sizeof(syslog_ng_dscp_val));
        int tmpSouravVal = 40;          //dilipu
        setsockopt(fd, SOL_IP, IP_TOS, &tmpSouravVal, sizeof(syslog_ng_dscp_val));
        setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &syslog_ng_dscp_val, sizeof(syslog_ng_dscp_val));

        if (sock_options->tos && (dir & AFSOCKET_DIR_SEND))
                setsockopt(fd, SOL_IP, IP_TOS, &sock_options->tos, sizeof(sock_options->tos));
  return TRUE;

Thanks and regards
Dilip Kumar B

L&T Technology Services Ltd


This Email may contain confidential or privileged information for the intended recipient (s). If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.balabit.hu/pipermail/syslog-ng/attachments/20150611/c25dd1ea/attachment.htm 

More information about the syslog-ng mailing list