~ubuntu-branches/ubuntu/oneiric/openvpn/oneiric

« back to all changes in this revision

Viewing changes to .pc/jjo-ipv6-support.patch/route.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-06-16 18:33:37 UTC
  • mfrom: (1.1.17 upstream) (10.2.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110616183337-fv50u3kmiabewjq0
Tags: 2.2.0-2ubuntu1
* 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 compatabliity.
  + debian/control: Add lsb-base >= 3.2-14 to allow status_of_proc()
  + debian/update-resolv-conf: Support multiple domains.
  + fix bug where '--script-security 2' would be passed for all
    daemons after the first. (LP: #794916

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
 
60
60
#endif
61
61
 
62
 
static bool
63
 
add_bypass_address (struct route_bypass *rb, const in_addr_t a)
64
 
{
65
 
  int i;
66
 
  for (i = 0; i < rb->n_bypass; ++i)
67
 
    {
68
 
      if (a == rb->bypass[i]) /* avoid duplicates */
69
 
        return true;
70
 
    }
71
 
  if (rb->n_bypass < N_ROUTE_BYPASS)
72
 
    {
73
 
      rb->bypass[rb->n_bypass++] = a;
74
 
      return true;
75
 
    }
76
 
  else
77
 
    {
78
 
      return false;
79
 
    }
80
 
}
81
 
 
82
62
struct route_option_list *
83
63
new_route_option_list (const int max_routes, struct gc_arena *a)
84
64
{
450
430
        struct route r;
451
431
        int k;
452
432
 
 
433
        CLEAR(netlist);         /* init_route() will not always init this */
 
434
 
453
435
        if (!init_route (&r,
454
436
                         &netlist,
455
437
                         &opt->routes[i],
950
932
  argv_printf (&argv, "%s add",
951
933
                ROUTE_PATH);
952
934
 
953
 
#if 0
954
 
  if (r->metric_defined)
955
 
    argv_printf_cat (&argv, "-rtt %d", r->metric);
956
 
#endif
957
 
 
958
935
  argv_printf_cat (&argv, "%s -netmask %s %s",
959
936
              network,
960
937
              netmask,
961
938
              gateway);
962
939
 
 
940
  if (r->metric_defined)
 
941
    argv_printf_cat (&argv, "%d", r->metric);
 
942
 
963
943
  argv_msg (D_ROUTE, &argv);
964
944
  status = openvpn_execve_check (&argv, es, 0, "ERROR: Solaris route add command failed");
965
945
 
2153
2133
static void
2154
2134
add_host_route_if_nonlocal (struct route_bypass *rb, const in_addr_t addr)
2155
2135
{
2156
 
  if (test_local_addr(addr) == TLA_NONLOCAL && addr != 0 && addr != ~0)
2157
 
    add_bypass_address (rb, addr);
 
2136
  if (test_local_addr(addr) == TLA_NONLOCAL && addr != 0 && addr != ~0) {
 
2137
    int i;
 
2138
    for (i = 0; i < rb->n_bypass; ++i)
 
2139
      {
 
2140
        if (addr == rb->bypass[i]) /* avoid duplicates */
 
2141
          return;
 
2142
      }
 
2143
    if (rb->n_bypass < N_ROUTE_BYPASS)
 
2144
      {
 
2145
        rb->bypass[rb->n_bypass++] = addr;
 
2146
      }
 
2147
  }
2158
2148
}
2159
2149
 
2160
2150
static void