Ticket #10: 0002-Make-topology-subnet-work-on-Solaris-ifconfig-route-.patch

File 0002-Make-topology-subnet-work-on-Solaris-ifconfig-route-.patch, 2.5 KB (added by Gert Döring, 13 years ago)

make "topology subnet" work on Solaris, add on top of first patch

  • route.c

    From f4e5ddbe83c1ccf90f40e3d614aa2d94458c5d8c Mon Sep 17 00:00:00 2001
    From: Gert Doering <gert@greenie.muc.de>
    Date: Sat, 30 Oct 2010 21:03:16 +0200
    Subject: [PATCH 2/2] Make "topology subnet" work on Solaris (ifconfig + route metric changes
     by Kazuyoshi Aizawa, adding of local "connected subnet" route by me)
    
    Tested on OpenSolaris/i386, no impact for other TARGETs.
    
    Signed-off-by: Gert Doering <gert@greenie.muc.de>
    ---
     route.c |    8 +++-----
     tun.c   |   27 +++++++++++++++++++++++++++
     2 files changed, 30 insertions(+), 5 deletions(-)
    
    diff --git a/route.c b/route.c
    index 20f62d5..c63eb41 100644
    a b add_route (struct route *r, const struct tuntap *tt, unsigned int flags, const s 
    952952  argv_printf (&argv, "%s add",
    953953                ROUTE_PATH);
    954954
    955 #if 0
    956   if (r->metric_defined)
    957     argv_printf_cat (&argv, "-rtt %d", r->metric);
    958 #endif
    959 
    960955  argv_printf_cat (&argv, "%s -netmask %s %s",
    961956              network,
    962957              netmask,
    963958              gateway);
    964959
     960  if (r->metric_defined)
     961    argv_printf_cat (&argv, "%d", r->metric);
     962
    965963  argv_msg (D_ROUTE, &argv);
    966964  status = openvpn_execve_check (&argv, es, 0, "ERROR: Solaris route add command failed");
    967965
  • tun.c

    diff --git a/tun.c b/tun.c
    index f001a64..0e4476e 100644
    a b do_ifconfig (struct tuntap *tt, 
    702702                            );
    703703        }
    704704      else
     705        if (tt->topology == TOP_SUBNET)
     706        {
     707          argv_printf (&argv,
     708                              "%s %s %s %s netmask %s mtu %d up",
     709                              IFCONFIG_PATH,
     710                              actual,
     711                              ifconfig_local,
     712                              ifconfig_local,
     713                              ifconfig_remote_netmask,
     714                              tun_mtu
     715                              );
     716        }
     717        else
    705718          argv_printf (&argv,
    706719                            " %s %s %s netmask %s broadcast + up",
    707720                            IFCONFIG_PATH,
    do_ifconfig (struct tuntap *tt, 
    714727      if (!openvpn_execve_check (&argv, es, 0, "Solaris ifconfig phase-2 failed"))
    715728        solaris_error_close (tt, es, actual);
    716729
     730      if (!tun && tt->topology == TOP_SUBNET)
     731        {
     732          /* Add a network route for the local tun interface */
     733          struct route r;
     734          CLEAR (r);     
     735          r.defined = true;       
     736          r.network = tt->local & tt->remote_netmask;
     737          r.netmask = tt->remote_netmask;
     738          r.gateway = tt->local; 
     739          r.metric_defined = true;
     740          r.metric = 0;
     741          add_route (&r, tt, 0, es);
     742        }
     743
    717744      tt->did_ifconfig = true;
    718745
    719746#elif defined(TARGET_OPENBSD)