Diff for /embedaddon/quagga/lib/sockopt.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2012/02/21 17:26:12 version 1.1.1.3, 2016/11/02 10:09:11
Line 179  getsockopt_ipv6_ifindex (struct msghdr *msgh) Line 179  getsockopt_ipv6_ifindex (struct msghdr *msgh)
       
   return pktinfo->ipi6_ifindex;    return pktinfo->ipi6_ifindex;
 }  }
 #endif /* HAVE_IPV6 */  
   
   int
   setsockopt_ipv6_tclass(int sock, int tclass)
   {
     int ret = 0;
   
   #ifdef IPV6_TCLASS /* RFC3542 */
     ret = setsockopt (sock, IPPROTO_IPV6, IPV6_TCLASS, &tclass, sizeof (tclass));
     if (ret < 0)
       zlog_warn ("Can't set IPV6_TCLASS option for fd %d to %#x: %s",
                  sock, tclass, safe_strerror(errno));
   #endif
     return ret;
   }
   #endif /* HAVE_IPV6 */
   
 /*  /*
  * Process multicast socket options for IPv4 in an OS-dependent manner.   * Process multicast socket options for IPv4 in an OS-dependent manner.
  * Supported options are IP_{ADD,DROP}_MEMBERSHIP.   * Supported options are IP_{ADD,DROP}_MEMBERSHIP.
Line 207  int Line 220  int
 setsockopt_ipv4_multicast(int sock,  setsockopt_ipv4_multicast(int sock,
                         int optname,                           int optname, 
                         unsigned int mcast_addr,                          unsigned int mcast_addr,
                        unsigned int ifindex)                        ifindex_t ifindex)
 {  {
 #ifdef HAVE_RFC3678  #ifdef HAVE_RFC3678
   struct group_req gr;    struct group_req gr;
Line 305  setsockopt_ipv4_multicast(int sock, Line 318  setsockopt_ipv4_multicast(int sock,
  * Set IP_MULTICAST_IF socket option in an OS-dependent manner.   * Set IP_MULTICAST_IF socket option in an OS-dependent manner.
  */   */
 int  int
setsockopt_ipv4_multicast_if(int sock,setsockopt_ipv4_multicast_if(int sock, ifindex_t ifindex)
                        unsigned int ifindex) 
 {  {
   
 #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX  #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX
Line 332  setsockopt_ipv4_multicast_if(int sock, Line 344  setsockopt_ipv4_multicast_if(int sock,
 }  }
       
 static int  static int
setsockopt_ipv4_ifindex (int sock, int val)setsockopt_ipv4_ifindex (int sock, ifindex_t val)
 {  {
   int ret;    int ret;
   
Line 368  setsockopt_ipv4_tos(int sock, int tos) Line 380  setsockopt_ipv4_tos(int sock, int tos)
   
   
 int  int
setsockopt_ifindex (int af, int sock, int val)setsockopt_ifindex (int af, int sock, ifindex_t val)
 {  {
   int ret = -1;    int ret = -1;
       
Line 395  setsockopt_ifindex (int af, int sock, int val) Line 407  setsockopt_ifindex (int af, int sock, int val)
  * Returns the interface index (small integer >= 1) if it can be   * Returns the interface index (small integer >= 1) if it can be
  * determined, or else 0.   * determined, or else 0.
  */   */
static intstatic ifindex_t
 getsockopt_ipv4_ifindex (struct msghdr *msgh)  getsockopt_ipv4_ifindex (struct msghdr *msgh)
 {  {
   /* XXX: initialize to zero?  (Always overwritten, so just cosmetic.) */    /* XXX: initialize to zero?  (Always overwritten, so just cosmetic.) */
  int ifindex = -1;  ifindex_t ifindex = -1;
   
 #if defined(IP_PKTINFO)  #if defined(IP_PKTINFO)
 /* Linux pktinfo based ifindex retrieval */  /* Linux pktinfo based ifindex retrieval */
Line 419  getsockopt_ipv4_ifindex (struct msghdr *msgh) Line 431  getsockopt_ipv4_ifindex (struct msghdr *msgh)
   struct sockaddr_dl *sdl;    struct sockaddr_dl *sdl;
 #else  #else
   /* SUNOS_5 uses an integer with the index. */    /* SUNOS_5 uses an integer with the index. */
  int *ifindex_p;  ifindex_t *ifindex_p;
 #endif /* SUNOS_5 */  #endif /* SUNOS_5 */
   
 #ifndef SUNOS_5  #ifndef SUNOS_5
Line 460  getsockopt_ipv4_ifindex (struct msghdr *msgh) Line 472  getsockopt_ipv4_ifindex (struct msghdr *msgh)
 }  }
   
 /* return ifindex, 0 if none found */  /* return ifindex, 0 if none found */
intifindex_t
 getsockopt_ifindex (int af, struct msghdr *msgh)  getsockopt_ifindex (int af, struct msghdr *msgh)
 {  {
   switch (af)    switch (af)
Line 503  sockopt_iphdrincl_swab_systoh (struct ip *iph) Line 515  sockopt_iphdrincl_swab_systoh (struct ip *iph)
 #endif /* HAVE_IP_HDRINCL_BSD_ORDER */  #endif /* HAVE_IP_HDRINCL_BSD_ORDER */
   
   iph->ip_id = ntohs(iph->ip_id);    iph->ip_id = ntohs(iph->ip_id);
   }
   
   int
   sockopt_tcp_rtt (int sock)
   {
   #ifdef TCP_INFO
     struct tcp_info ti;
     socklen_t len = sizeof(ti);
   
     if (getsockopt (sock, IPPROTO_TCP, TCP_INFO, &ti, &len) != 0)
       return 0;
   
     return ti.tcpi_rtt / 1000;
   #else
     return 0;
   #endif
 }  }
   
 int  int

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>