~ubuntu-branches/ubuntu/precise/openvpn/precise-updates

« back to all changes in this revision

Viewing changes to route.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-10-05 06:21:14 UTC
  • mfrom: (1.1.16 upstream) (10.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20101005062114-18lyqud9e3p4g735
Tags: 2.1.3-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  + debian/openvpn.init.d:
    - Do not use start-stop-daemon and </dev/null to avoid blocking boot.
    - Show per-VPN result messages.
    - Add "--script-security 2" by default for backwards compatablitiy
  + debian/control: Add lsb-base >= 3.2-14 to allow status_of_proc()

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *             packet encryption, packet authentication, and
6
6
 *             packet compression.
7
7
 *
8
 
 *  Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@openvpn.net>
 
8
 *  Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
9
9
 *
10
10
 *  This program is free software; you can redistribute it and/or modify
11
11
 *  it under the terms of the GNU General Public License version 2
219
219
 
220
220
static bool
221
221
init_route (struct route *r,
 
222
            struct resolve_list *network_list,
222
223
            const struct route_option *ro,
223
224
            const struct route_special_addr *spec)
224
225
{
237
238
  
238
239
  if (!get_special_addr (spec, ro->network, &r->network, &status))
239
240
    {
240
 
      r->network = getaddr (
241
 
                            GETADDR_RESOLVE
242
 
                            | GETADDR_HOST_ORDER
243
 
                            | GETADDR_WARN_ON_SIGNAL,
244
 
                            ro->network,
245
 
                            0,
246
 
                            &status,
247
 
                            NULL);
 
241
      r->network = getaddr_multi (
 
242
                                  GETADDR_RESOLVE
 
243
                                  | GETADDR_HOST_ORDER
 
244
                                  | GETADDR_WARN_ON_SIGNAL,
 
245
                                  ro->network,
 
246
                                  0,
 
247
                                  &status,
 
248
                                  NULL,
 
249
                                  network_list);
248
250
    }
249
251
 
250
252
  if (!status)
438
440
  else
439
441
    rl->spec.remote_endpoint_defined = false;
440
442
 
441
 
  if (!(opt->n >= 0 && opt->n <= rl->capacity))
442
 
    msg (M_FATAL, PACKAGE_NAME " ROUTE: (init) number of route options (%d) is greater than route list capacity (%d)", opt->n, rl->capacity);
443
 
 
444
443
  /* parse the routes from opt to rl */
445
444
  {
446
445
    int i, j = 0;
 
446
    bool warned = false;
447
447
    for (i = 0; i < opt->n; ++i)
448
448
      {
449
 
        if (!init_route (&rl->routes[j],
 
449
        struct resolve_list netlist;
 
450
        struct route r;
 
451
        int k;
 
452
 
 
453
        if (!init_route (&r,
 
454
                         &netlist,
450
455
                         &opt->routes[i],
451
456
                         &rl->spec))
452
457
          ret = false;
453
458
        else
454
 
          ++j;
 
459
          {
 
460
            if (!netlist.len)
 
461
              {
 
462
                netlist.data[0] = r.network;
 
463
                netlist.len = 1;
 
464
              }
 
465
            for (k = 0; k < netlist.len; ++k)
 
466
              {
 
467
                if (j < rl->capacity)
 
468
                  {
 
469
                    r.network = netlist.data[k];
 
470
                    rl->routes[j++] = r;
 
471
                  }
 
472
                else
 
473
                  {
 
474
                    if (!warned)
 
475
                      {
 
476
                        msg (M_WARN, PACKAGE_NAME " ROUTE: routes dropped because number of expanded routes is greater than route list capacity (%d)", rl->capacity);
 
477
                        warned = true;
 
478
                      }
 
479
                  }
 
480
              }
 
481
          }
455
482
      }
456
483
    rl->n = j;
457
484
  }
2196
2223
 
2197
2224
#endif
2198
2225
 
2199
 
#if AUTO_USERID
 
2226
#if AUTO_USERID || defined(ENABLE_PUSH_PEER_INFO)
2200
2227
 
2201
2228
#if defined(TARGET_LINUX)
2202
2229