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));

              }

        else

        {

                if (sock_options->ttl && (dir & AFSOCKET_DIR_SEND))

                        setsockopt(fd, SOL_IP, IP_TTL, &sock_options->ttl, sizeof(sock_options->ttl));

        }

#if CONFIG_CP_DSCP

        //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));

#if (CONFIG_CP_IPV6 && CONFIG_CP_DSCP)

        setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &syslog_ng_dscp_val, sizeof(syslog_ng_dscp_val));

#endif

#else

 

        if (sock_options->tos && (dir & AFSOCKET_DIR_SEND))

                setsockopt(fd, SOL_IP, IP_TOS, &sock_options->tos, sizeof(sock_options->tos));

#endif

        break;

      }

    }

  return TRUE;

}

 

 

 

Thanks and regards

Dilip Kumar B

L&T Technology Services Ltd

www.LntTechservices.com

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.