diff options
author | paul <paul> | 2004-05-05 17:29:24 +0000 |
---|---|---|
committer | paul <paul> | 2004-05-05 17:29:24 +0000 |
commit | 8a5e9596301214461f84abf178d1a6b265629d94 (patch) | |
tree | d0d764c1164960833343cd7192a18be82c1de2f0 /ospfd/ospf_network.c | |
parent | 0d3daad62e6c67f80498cb5aa0d27e8f934d6400 (diff) | |
download | quagga-8a5e9596301214461f84abf178d1a6b265629d94.tar.bz2 quagga-8a5e9596301214461f84abf178d1a6b265629d94.tar.xz |
2004-05-05 Paul Jakma <paul@dishone.st>
* ospf_network.c: (ospf_sock_init) Check whether IP_HDRINCL is
defined. Warn at compile and runtime. Use
IPTOS_PREC_INTERNETCONTROL otherwise.
Diffstat (limited to 'ospfd/ospf_network.c')
-rw-r--r-- | ospfd/ospf_network.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index 87dfb60a..2766abd5 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -170,9 +170,20 @@ ospf_sock_init (void) exit(-1); } - +#ifdef IP_HDRINCL + /* we will include IP header with packet */ + ret = setsockopt (ospf_sock, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof (hincl)); + if (ret < 0) + { + if ( ospfd_privs.change (ZPRIVS_LOWER) ) + zlog_err ("ospf_sock_init: could not lower privs, %s", + strerror (errno) ); + zlog_warn ("Can't set IP_HDRINCL option"); + } +#elif defined (IPTOS_PREC_INTERNETCONTROL) +#warning "IP_HDRINCL not available on this system" +#warning "using IPTOS_PREC_INTERNETCONTROL" /* Set precedence field. */ -#ifdef IPTOS_PREC_INTERNETCONTROL tos = IPTOS_PREC_INTERNETCONTROL; ret = setsockopt (ospf_sock, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof (int)); @@ -185,17 +196,10 @@ ospf_sock_init (void) close (ospf_sock); /* Prevent sd leak. */ return ret; } -#endif /* IPTOS_PREC_INTERNETCONTROL */ - - /* we will include IP header with packet */ - ret = setsockopt (ospf_sock, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof (hincl)); - if (ret < 0) - { - if ( ospfd_privs.change (ZPRIVS_LOWER) ) - zlog_err ("ospf_sock_init: could not lower privs, %s", - strerror (errno) ); - zlog_warn ("Can't set IP_HDRINCL option"); - } +#else /* !IPTOS_PREC_INTERNETCONTROL */ +#warning "IP_HDRINCL not available, nor is IPTOS_PREC_INTERNETCONTROL" + zlog_warn ("IP_HDRINCL option not available"); +#endif /* IP_HDRINCL */ #if defined (IP_PKTINFO) ret = setsockopt (ospf_sock, IPPROTO_IP, IP_PKTINFO, &hincl, sizeof (hincl)); |