~yolanda.robla/ubuntu/saucy/freeradius/dep-8-tests

« back to all changes in this revision

Viewing changes to src/lib/udpfromto.c

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: james.westby@ubuntu.com-20091123035737-snauioz5r9tf8sdr
Tags: upstream-2.1.7+dfsg
ImportĀ upstreamĀ versionĀ 2.1.7+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 * sendfromto   added 18/08/2003, Jan Berkel <jan@sitadelle.com>
33
33
 *              Works on Linux and FreeBSD (5.x)
34
34
 *
35
 
 * Version: $Id: udpfromto.c,v 1.13 2007/06/04 13:23:08 nbk Exp $
 
35
 * Version: $Id$
36
36
 */
37
37
 
38
38
#include <freeradius-devel/ident.h>
39
 
RCSID("$Id: udpfromto.c,v 1.13 2007/06/04 13:23:08 nbk Exp $")
 
39
RCSID("$Id$")
40
40
 
41
41
#include <freeradius-devel/udpfromto.h>
42
42
 
71
71
                flag = IP_PKTINFO;
72
72
#endif
73
73
                
74
 
#ifdef HAVE_IP_RECVDSTADDR
 
74
#ifdef IP_RECVDSTADDR
75
75
                /*
76
76
                 *      Set the IP_RECVDSTADDR option (BSD).  Note:
77
77
                 *      IP_RECVDSTADDR == IP_SENDSRCADDR
117
117
        struct sockaddr_storage si;
118
118
        socklen_t si_len = sizeof(si);
119
119
 
120
 
#if !defined(HAVE_IP_PKTINFO) && !defined(HAVE_IP_RECVDSTADDR) && !defined (HAVE_IN6_PKTINFO)
 
120
#if !defined(HAVE_IP_PKTINFO) && !defined(IP_RECVDSTADDR) && !defined (HAVE_IN6_PKTINFO)
121
121
        /*
122
122
         *      If the recvmsg() flags aren't defined, fall back to
123
123
         *      using recvfrom().
154
154
                *tolen = sizeof(*dst);
155
155
                *dst = *src;
156
156
 
157
 
#if !defined(HAVE_IP_PKTINFO) && !defined(HAVE_IP_RECVDSTADDR)
 
157
#if !defined(HAVE_IP_PKTINFO) && !defined(IP_RECVDSTADDR)
158
158
                /*
159
159
                 *      recvmsg() flags aren't defined.  Use recvfrom()
160
160
                 */
225
225
                }
226
226
#endif
227
227
 
228
 
#ifdef HAVE_IP_RECVDSTADDR
229
 
                if ((cmsg->cmsg_level == IPPROTO_IP)
 
228
#ifdef IP_RECVDSTADDR
 
229
                if ((cmsg->cmsg_level == IPPROTO_IP) &&
230
230
                    (cmsg->cmsg_type == IP_RECVDSTADDR)) {
231
231
                        struct in_addr *i = (struct in_addr *) CMSG_DATA(cmsg);
232
232
                        ((struct sockaddr_in *)to)->sin_addr = *i;
259
259
        struct iovec iov;
260
260
        char cbuf[256];
261
261
 
262
 
#if !defined(HAVE_IP_PKTINFO) && !defined(HAVE_IP_SENDSRCADDR) && !defined(HAVE_IN6_PKTINFO)
 
262
#if !defined(HAVE_IP_PKTINFO) && !defined(IP_SENDSRCADDR) && !defined(HAVE_IN6_PKTINFO)
263
263
        /*
264
264
         *      If the sendmsg() flags aren't defined, fall back to
265
265
         *      using sendto().
302
302
                pkt->ipi_spec_dst = s4->sin_addr;
303
303
#endif
304
304
 
305
 
#ifdef HAVE_IP_SENDSRCADDR
 
305
#ifdef IP_SENDSRCADDR
306
306
                struct in_addr *in;
307
307
 
308
308
                msgh.msg_control = cbuf;