Okay, so this is what I get when I hit send too quick... Doh!

On Fri, 29 Jan 1999, Erik Muller wrote:

> The enclosed patch adds support for defining the metric assigned to the
> installed default route... very useful if you want to use diald with
> gated/routed to provide automatic backup for another network connection.  
> This is against 0.98.1, and is tested and works on my system (2.0.36,
> libc5.4.46, net-tools 1.50, pppd-2.2.0f).
> 
> Please check it out and let me know of any problems - I'd like to see this
> feature added to the 1.0 release...
> 
> -erik
> 

## cut here ##

diff -rc diald-0.98.1.dist/dev.c diald-0.98.1/dev.c
*** diald-0.98.1.dist/dev.c     Wed Jan  6 12:53:47 1999
--- diald-0.98.1/dev.c  Fri Jan 29 09:21:19 1999
***************
*** 125,132 ****
        && (dynamic_addrs || (blocked && !blocked_route))) {
            proxy_config(local_ip,remote_ip);
            set_ptp("sl",proxy_iface,remote_ip,1);
!           del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
!           add_routes("sl",proxy_iface,local_ip,remote_ip,1); 
        } 
  
  #if 1
--- 125,132 ----
        && (dynamic_addrs || (blocked && !blocked_route))) {
            proxy_config(local_ip,remote_ip);
            set_ptp("sl",proxy_iface,remote_ip,1);
!           del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 
1));
!           add_routes("sl",proxy_iface,local_ip,remote_ip,(defaultmetric + 1)); 
        } 
  
  #if 1
***************
*** 138,145 ****
  #endif
  
        if (do_reroute) {
!              add_routes(device_node,link_iface,local_ip,remote_ip,0);
!            del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
        }
          return 1;
  }
--- 138,145 ----
  #endif
  
        if (do_reroute) {
!              add_routes(device_node,link_iface,local_ip,remote_ip,defaultmetric);
!            del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 
1));
        }
          return 1;
  }
***************
*** 190,202 ****
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
      }
      local_addr = inet_addr(orig_local_ip);
  
      /* Kill the alternate routing */
      if (do_reroute && link_iface != -1)
!         del_routes(device_node,link_iface,local_ip,remote_ip,0);
      link_iface = -1;
  }
  
--- 190,202 ----
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 1));
      }
      local_addr = inet_addr(orig_local_ip);
  
      /* Kill the alternate routing */
      if (do_reroute && link_iface != -1)
!         del_routes(device_node,link_iface,local_ip,remote_ip,defaultmetric);
      link_iface = -1;
  }
  
diff -rc diald-0.98.1.dist/diald.h diald-0.98.1/diald.h
*** diald-0.98.1.dist/diald.h   Mon Jan 25 14:19:06 1999
--- diald-0.98.1/diald.h        Fri Jan 29 09:21:19 1999
***************
*** 290,295 ****
--- 290,296 ----
  int demasq;
  #endif
  int route_wait;
+ int defaultmetric;
  
  #ifdef SIOCSKEEPALIVE
  extern int keepalive;
Only in diald-0.98.1: diald.h.orig
diff -rc diald-0.98.1.dist/doc/diald.man diald-0.98.1/doc/diald.man
*** diald-0.98.1.dist/doc/diald.man     Mon Jan 25 14:19:09 1999
--- diald-0.98.1/doc/diald.man  Fri Jan 29 09:21:19 1999
***************
*** 712,717 ****
--- 712,723 ----
  .B diald
  to set up a default route to the SLIP link.
  .TP
+ .B defaultmetric \fI<n>
+ Sets the metric that will be assigned to the default route installed
+ by diald.  Default value is 0. This is useful if you want diald to run as
+ a backup for another network connection which would normally have a higher
+ metric.
+ .TP
  .B proxyarp
  Tell diald to add an entry to this system's ARP [Address Resolution Protocol]
  table with the IP address of the remote system, and the Ethernet address
Only in diald-0.98.1/doc: diald.man.orig
diff -rc diald-0.98.1.dist/options.c diald-0.98.1/options.c
*** diald-0.98.1.dist/options.c Mon Jan 25 14:19:07 1999
--- diald-0.98.1/options.c      Fri Jan 29 09:21:19 1999
***************
*** 78,83 ****
--- 78,84 ----
  int demasq = 0;
  #endif
  int route_wait = 0;
+ int defaultmetric = 1;
  
  int connect_timeout = 60;
  int disconnect_timeout = 60;
***************
*** 150,155 ****
--- 151,157 ----
      {"strict-forwarding","",0,&strict_forwarding,set_flag},
      {"dslip-mode","<mode>",1,0,set_dslip_mode},
      {"defaultroute","",0,&default_route,set_flag},
+     {"defaultmetric","<metric>",1,&defaultmetric,set_int},
      {"addroute","<script>",1,&addroute,set_str},
      {"delroute","<script>",1,&delroute,set_str},
      {"proxyarp","",0,&proxyarp,set_flag},
***************
*** 271,276 ****
--- 273,279 ----
      slip_encap = 0;
      lock_dev = 0;
      default_route = 0;
+     defaultmetric = 1;
      strict_forwarding = 0;
      dynamic_addrs = 0;
      dynamic_mode = DMODE_REMOTE_LOCAL;
***************
*** 407,413 ****
  void set_blocked(int *var, char **argv)
  {
      if (!blocked_route && state == STATE_DOWN && *var == 0) {
!       del_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, 1);
        del_ptp("sl", proxy_iface, orig_remote_ip);
      }
      *var = 1;
--- 410,416 ----
  void set_blocked(int *var, char **argv)
  {
      if (!blocked_route && state == STATE_DOWN && *var == 0) {
!       del_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, (defaultmetric + 
1));
        del_ptp("sl", proxy_iface, orig_remote_ip);
      }
      *var = 1;
***************
*** 417,423 ****
  {
      if (!blocked_route && state == STATE_DOWN && *var == 1) {
        set_ptp("sl", proxy_iface, orig_remote_ip, 1);
!       add_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, 1);
      }
      *var = 0;
  }
--- 420,426 ----
  {
      if (!blocked_route && state == STATE_DOWN && *var == 1) {
        set_ptp("sl", proxy_iface, orig_remote_ip, 1);
!       add_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, (defaultmetric + 
1));
      }
      *var = 0;
  }
***************
*** 426,432 ****
  {
      if (blocked && state == STATE_DOWN && *var == 0) {
        set_ptp("sl", proxy_iface, orig_remote_ip, 1);
!       add_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, 1);
      }
      *var = 1;
  }
--- 429,435 ----
  {
      if (blocked && state == STATE_DOWN && *var == 0) {
        set_ptp("sl", proxy_iface, orig_remote_ip, 1);
!       add_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, (defaultmetric + 
1));
      }
      *var = 1;
  }
***************
*** 434,440 ****
  void clear_blocked_route(int *var, char **argv)
  {
      if (blocked && state == STATE_DOWN && *var == 1) {
!       del_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, 1);
        del_ptp("sl", proxy_iface, orig_remote_ip);
      }
      *var = 0;
--- 437,443 ----
  void clear_blocked_route(int *var, char **argv)
  {
      if (blocked && state == STATE_DOWN && *var == 1) {
!       del_routes("sl", proxy_iface, orig_local_ip, orig_remote_ip, (defaultmetric + 
1));
        del_ptp("sl", proxy_iface, orig_remote_ip);
      }
      *var = 0;
Only in diald-0.98.1: options.c.orig
diff -rc diald-0.98.1.dist/ppp.c diald-0.98.1/ppp.c
*** diald-0.98.1.dist/ppp.c     Wed Jan  6 12:53:48 1999
--- diald-0.98.1/ppp.c  Fri Jan 29 09:21:19 1999
***************
*** 203,210 ****
             */
            proxy_config(local_ip,remote_ip);
            set_ptp("sl",proxy_iface,remote_ip,1);
!           del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
!           add_routes("sl",proxy_iface,local_ip,remote_ip,1); 
        }
  
  #if 1
--- 203,210 ----
             */
            proxy_config(local_ip,remote_ip);
            set_ptp("sl",proxy_iface,remote_ip,1);
!           del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 
1));
!           add_routes("sl",proxy_iface,local_ip,remote_ip,(defaultmetric + 1)); 
        }
  
  #if 1
***************
*** 215,222 ****
  #endif
  
        if (do_reroute) {
!            add_routes("ppp",link_iface,local_ip,remote_ip,0);
!            del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
        }
        return 1;
      }
--- 215,222 ----
  #endif
  
        if (do_reroute) {
!            add_routes("ppp",link_iface,local_ip,remote_ip,defaultmetric);
!            del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 
1));
        }
        return 1;
      }
***************
*** 296,307 ****
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
      }
      local_addr = inet_addr(orig_local_ip);
      /* If we did routing on the ppp link, remove it */
      if (do_reroute && link_iface != -1)
!       del_routes("ppp",link_iface,local_ip,remote_ip,0);
      link_iface = -1;
  }
  
--- 296,307 ----
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 1));
      }
      local_addr = inet_addr(orig_local_ip);
      /* If we did routing on the ppp link, remove it */
      if (do_reroute && link_iface != -1)
!       del_routes("ppp",link_iface,local_ip,remote_ip,defaultmetric);
      link_iface = -1;
  }
  
diff -rc diald-0.98.1.dist/proxy.c diald-0.98.1/proxy.c
*** diald-0.98.1.dist/proxy.c   Mon Jan 25 14:19:07 1999
--- diald-0.98.1/proxy.c        Fri Jan 29 09:21:19 1999
***************
*** 197,203 ****
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
      }
  }
  
--- 197,203 ----
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 1));
      }
  }
  
***************
*** 228,234 ****
  
      if (debug&DEBUG_VERBOSE)
        mon_syslog(LOG_INFO,"taking proxy device down");
!     del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
  
      /* mark the interface as down */
      sprintf(buf,"%s sl%d down", path_ifconfig,proxy_iface);
--- 228,234 ----
  
      if (debug&DEBUG_VERBOSE)
        mon_syslog(LOG_INFO,"taking proxy device down");
!     del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 1));
  
      /* mark the interface as down */
      sprintf(buf,"%s sl%d down", path_ifconfig,proxy_iface);
diff -rc diald-0.98.1.dist/slip.c diald-0.98.1/slip.c
*** diald-0.98.1.dist/slip.c    Sat Jan 23 14:51:07 1999
--- diald-0.98.1/slip.c Fri Jan 29 09:21:20 1999
***************
*** 267,279 ****
      && ((dynamic_addrs || force_dynamic) || (blocked && !blocked_route))) {
        proxy_config(local_ip,remote_ip);
        set_ptp("sl",proxy_iface,remote_ip,1);
!       del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,local_ip,remote_ip,1);
      }
  
      if (do_reroute) {
!         add_routes("sl",link_iface,local_ip,remote_ip,0);
!       del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
      }
  
      return 1;
--- 267,279 ----
      && ((dynamic_addrs || force_dynamic) || (blocked && !blocked_route))) {
        proxy_config(local_ip,remote_ip);
        set_ptp("sl",proxy_iface,remote_ip,1);
!       del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 1));
!       add_routes("sl",proxy_iface,local_ip,remote_ip,(defaultmetric + 1));
      }
  
      if (do_reroute) {
!         add_routes("sl",link_iface,local_ip,remote_ip,defaultmetric);
!       del_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,defaultmetric);
      }
  
      return 1;
***************
*** 304,315 ****
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,1);
      }
      local_addr = inet_addr(orig_local_ip);
      /* If we did routing on the slip link, remove it */
      if (do_reroute && link_iface != -1) /* just in case we get called twice */
!       del_routes("sl",link_iface,local_ip,remote_ip,0);
      link_iface = -1;
  }
  
--- 304,315 ----
        del_ptp("sl",proxy_iface,orig_remote_ip);
      else {
        set_ptp("sl",proxy_iface,orig_remote_ip,1);
!       add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,(defaultmetric + 1));
      }
      local_addr = inet_addr(orig_local_ip);
      /* If we did routing on the slip link, remove it */
      if (do_reroute && link_iface != -1) /* just in case we get called twice */
!       del_routes("sl",link_iface,local_ip,remote_ip,defaultmetric);
      link_iface = -1;
  }

## cut here ##  




-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to