Description: Make --ifref default to name.
 The order of the interfaces is unreliable,and ifref=name 
 is really a much better default.
Author: Soren Hansen <soren@ubuntu.com>

---
 bin/cfgmaker   |   12 ++++++++----
 doc/cfgmaker.1 |    6 +++---
 2 files changed, 11 insertions(+), 7 deletions(-)

--- mrtg-2.17.3.orig/bin/cfgmaker
+++ mrtg-2.17.3/bin/cfgmaker
@@ -675,7 +675,11 @@ ECHO
                         $if_ok = 0;
                     }
                 } else {
-                    $if_ref = $ifindex;
+                    if ($$i{Name}) {
+                        $if_ref = "#".$$i{Name};
+                    } else {
+                        $if_ref = $ifindex;
+                    }
                 }
 
                 # generate Target name
@@ -1575,11 +1579,11 @@ cfgmaker [options] [community@]router [[
 
 =head1 OPTIONS
 
- --ifref=nr    interface references by Interface Number (default)
- --ifref=ip                     ... by Ip Address
+ --ifref=name      interface references by Interface Name (default)
+ --ifref=ip                         ... by Ip Address
  --ifref=eth                        ... by Ethernet Number
  --ifref=descr                      ... by Interface Description
- --ifref=name                       ... by Interface Name
+ --ifref=nr                         ... by Interface Number
  --ifref=type                       ... by Interface Type
                 You may also use multiple options separated by commas,
                in which case the first available one is used:
--- mrtg-2.17.3.orig/doc/cfgmaker.1
+++ mrtg-2.17.3/doc/cfgmaker.1
@@ -137,11 +137,11 @@ cfgmaker [options] [community@]router [[
 .SH "OPTIONS"
 .IX Header "OPTIONS"
 .Vb 9
-\& \-\-ifref=nr    interface references by Interface Number (default)
-\& \-\-ifref=ip                     ... by Ip Address
+\& \-\-ifref=name      interface references by Interface Name (default)
+\& \-\-ifref=ip                         ... by Ip Address
 \& \-\-ifref=eth                        ... by Ethernet Number
 \& \-\-ifref=descr                      ... by Interface Description
-\& \-\-ifref=name                       ... by Interface Name
+\& \-\-ifref=nr                         ... by Interface Number
 \& \-\-ifref=type                       ... by Interface Type
 \&                You may also use multiple options separated by commas,
 \&               in which case the first available one is used:
