From Sven-Ola Tuecke <sven-ola@gmx.de>: bugfix on Windows Vista: add interface metric...
authorHannes Gredler <hannes@gredler.at>
Sun, 27 Jan 2008 18:04:33 +0000 (19:04 +0100)
committerHannes Gredler <hannes@gredler.at>
Sun, 27 Jan 2008 18:04:33 +0000 (19:04 +0100)
gui/win32/Main/Frontend.rc
gui/win32/Main/resource.h
gui/win32/Main/trustInfo.manifest
src/interfaces.c
src/interfaces.h
src/win32/kernel_routes.c

index da40751..ec31e90 100644 (file)
@@ -1,4 +1,4 @@
-// Microsoft Visual C++ generated resource script.
+//Microsoft Developer Studio generated resource script.
 //
 #include "resource.h"
 
@@ -13,7 +13,7 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// Englisch (USA) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
 #ifdef _WIN32
@@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 // TEXTINCLUDE
 //
 
-1 TEXTINCLUDE 
+1 TEXTINCLUDE MOVEABLE PURE 
 BEGIN
     "resource.h\0"
 END
 
-2 TEXTINCLUDE 
+2 TEXTINCLUDE MOVEABLE PURE 
 BEGIN
     "#include ""afxres.h""\r\n"
     "\0"
 END
 
-3 TEXTINCLUDE 
+3 TEXTINCLUDE MOVEABLE PURE 
 BEGIN
     "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
     "#define _AFX_NO_OLE_RESOURCES\r\n"
@@ -65,7 +65,8 @@ END
 //
 
 IDD_FRONTEND_DIALOG DIALOGEX 0, 0, 399, 289
-STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | 
+    WS_SYSMENU
 EXSTYLE WS_EX_APPWINDOW
 CAPTION "olsr.org Switch 0.5.0"
 FONT 8, "MS Sans Serif", 0, 0, 0x1
@@ -76,11 +77,12 @@ BEGIN
     PUSHBUTTON      "Exit",IDC_BUTTON3,340,268,50,14
 END
 
-IDD_DIALOG1 DIALOG  0, 0, 377, 240
-STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
+IDD_DIALOG1 DIALOG DISCARDABLE  0, 0, 377, 240
+STYLE WS_CHILD | WS_VISIBLE
 FONT 8, "MS Sans Serif"
 BEGIN
-    EDITTEXT        IDC_EDIT1,7,25,363,208,ES_MULTILINE | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
+    EDITTEXT        IDC_EDIT1,7,25,363,208,ES_MULTILINE | ES_READONLY | 
+                    ES_WANTRETURN | WS_VSCROLL | WS_HSCROLL
     PUSHBUTTON      "Freeze",IDC_BUTTON3,152,7,50,14
     PUSHBUTTON      "Continue",IDC_BUTTON2,208,7,50,14
     PUSHBUTTON      "Save",IDC_BUTTON4,264,7,50,14
@@ -88,14 +90,18 @@ BEGIN
 END
 
 IDD_DIALOG2 DIALOGEX 0, 0, 377, 240
-STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
-FONT 8, "MS Sans Serif", 0, 0, 0x0
+STYLE WS_CHILD | WS_VISIBLE
+FONT 8, "MS Sans Serif"
 BEGIN
-    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_LIST | WS_BORDER | WS_TABSTOP,7,19,103,76
-    CONTROL         "Slider2",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,8,116,87,26
+    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_LIST | WS_BORDER | 
+                    WS_TABSTOP,7,19,103,76
+    CONTROL         "Slider2",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS | 
+                    TBS_BOTH | WS_TABSTOP,8,116,87,26
     EDITTEXT        IDC_EDIT7,55,153,26,12,ES_RIGHT
-    CONTROL         "Enable IP version 6",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,171,93,10
-    CONTROL         "Offer Internet connection",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,187,93,10
+    CONTROL         "Enable IP version 6",IDC_CHECK3,"Button",
+                    BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,171,93,10
+    CONTROL         "Offer Internet connection",IDC_CHECK2,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,7,187,93,10
     EDITTEXT        IDC_EDIT1,189,7,26,12,ES_RIGHT
     EDITTEXT        IDC_EDIT2,305,7,26,12,ES_RIGHT
     EDITTEXT        IDC_EDIT3,189,23,26,12,ES_RIGHT
@@ -104,15 +110,21 @@ BEGIN
     EDITTEXT        IDC_EDIT10,305,39,26,12,ES_RIGHT
     EDITTEXT        IDC_EDIT5,189,55,26,12,ES_RIGHT
     EDITTEXT        IDC_EDIT6,305,55,26,12,ES_RIGHT
-    COMBOBOX        IDC_COMBO1,189,76,26,41,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_COMBO1,189,76,26,41,CBS_DROPDOWNLIST | CBS_SORT | 
+                    WS_VSCROLL | WS_TABSTOP
     EDITTEXT        IDC_EDIT15,305,77,26,12,ES_RIGHT | ES_NUMBER
-    CONTROL         "Enable hysteresis",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,134,101,74,10
+    CONTROL         "Enable hysteresis",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,134,101,74,10
     EDITTEXT        IDC_EDIT12,189,115,26,12,ES_RIGHT
     EDITTEXT        IDC_EDIT13,305,115,26,12,ES_RIGHT
     EDITTEXT        IDC_EDIT11,189,131,26,12,ES_RIGHT
-    CONTROL         "Enable ETX link quality",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,155,92,10
-    CONTROL         "for MPR selection only",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,132,171,87,10
-    CONTROL         "for MPR selection and routing",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,132,187,109,10
+    CONTROL         "Enable ETX link quality",IDC_CHECK4,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,132,155,92,10
+    CONTROL         "for MPR selection only",IDC_RADIO1,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,132,171,87,10
+    CONTROL         "for MPR selection and routing",IDC_RADIO2,"Button",
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,132,187,109,
+                    10
     EDITTEXT        IDC_EDIT14,305,169,26,12,ES_RIGHT | ES_NUMBER
     PUSHBUTTON      "Open",IDC_BUTTON4,210,219,50,14
     PUSHBUTTON      "Save",IDC_BUTTON5,265,219,50,14
@@ -144,26 +156,32 @@ BEGIN
     RTEXT           "Scaling:",IDC_STATIC,132,133,26,8
     RTEXT           "High mark:",IDC_STATIC,247,117,35,8
     RTEXT           "Window size:",IDC_STATIC,247,171,43,8
-    CONTROL         "Enable Fish Eye",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,249,187,92,10
+    CONTROL         "Enable Fish Eye",IDC_CHECK5,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,249,187,92,10
 END
 
-IDD_DIALOG3 DIALOG  0, 0, 377, 240
-STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
+IDD_DIALOG3 DIALOG DISCARDABLE  0, 0, 377, 240
+STYLE WS_CHILD | WS_VISIBLE
 FONT 8, "MS Sans Serif"
 BEGIN
-    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,18,239,215
-    CONTROL         "List4",IDC_LIST4,"SysListView32",LVS_REPORT | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,18,115,66
-    CONTROL         "List4",IDC_LIST5,"SysListView32",LVS_REPORT | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,92,115,66
-    CONTROL         "List4",IDC_LIST6,"SysListView32",LVS_REPORT | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,167,115,66
+    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_REPORT | 
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,18,239,215
+    CONTROL         "List4",IDC_LIST4,"SysListView32",LVS_REPORT | 
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,18,115,66
+    CONTROL         "List4",IDC_LIST5,"SysListView32",LVS_REPORT | 
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,92,115,66
+    CONTROL         "List4",IDC_LIST6,"SysListView32",LVS_REPORT | 
+                    LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,255,167,115,66
     LTEXT           "Node list",IDC_STATIC,7,7,32,8
     LTEXT           "Node information",IDC_STATIC,257,7,59,8
 END
 
-IDD_DIALOG4 DIALOG  0, 0, 377, 240
-STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
+IDD_DIALOG4 DIALOG DISCARDABLE  0, 0, 377, 240
+STYLE WS_CHILD | WS_VISIBLE
 FONT 8, "MS Sans Serif"
 BEGIN
-    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,7,18,363,215
+    CONTROL         "List1",IDC_LIST1,"SysListView32",LVS_REPORT | WS_BORDER | 
+                    WS_TABSTOP,7,18,363,215
     LTEXT           "Routing table",IDC_STATIC,7,7,48,8
 END
 
@@ -174,7 +192,7 @@ END
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO 
+GUIDELINES DESIGNINFO MOVEABLE PURE 
 BEGIN
     IDD_FRONTEND_DIALOG, DIALOG
     BEGIN
@@ -226,16 +244,16 @@ END
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
-IDI_ICON1               ICON                    "res\\Frontend.ico"
-IDI_ICON3               ICON                    "res\\Tray2.ico"
-IDI_ICON2               ICON                    "res\\Tray1.ico"
+IDI_ICON1               ICON    DISCARDABLE     "res\\Frontend.ico"
+IDI_ICON3               ICON    DISCARDABLE     "res\\Tray2.ico"
+IDI_ICON2               ICON    DISCARDABLE     "res\\Tray1.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // Menu
 //
 
-IDR_TRAYMENU MENU 
+IDR_TRAYMENU MENU DISCARDABLE 
 BEGIN
     POPUP "IDR_TRAYMENU"
     BEGIN
@@ -268,7 +286,14 @@ BEGIN
     0
 END
 
-#endif    // English (U.S.) resources
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// 24
+//
+
+1                       24      DISCARDABLE     "trustInfo.manifest"
+#endif    // Englisch (USA) resources
 /////////////////////////////////////////////////////////////////////////////
 
 
index 5221413..d5cacc2 100644 (file)
@@ -1,5 +1,5 @@
 //{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
+// Microsoft Developer Studio generated include file.
 // Used by Frontend.rc
 //
 #define IDD_FRONTEND_DIALOG             102
@@ -60,7 +60,7 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        142
+#define _APS_NEXT_RESOURCE_VALUE        143
 #define _APS_NEXT_COMMAND_VALUE         32779
 #define _APS_NEXT_CONTROL_VALUE         1032
 #define _APS_NEXT_SYMED_VALUE           101
index d3cec03..fd3fb47 100644 (file)
@@ -1,4 +1,5 @@
-<assembly>
+<?xml version="1.0" encoding="utf-8"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
     <security>
       <requestedPrivileges>
@@ -7,4 +8,3 @@
     </security>
   </trustInfo>
 </assembly>
-
index dce4f09..76e8fcb 100644 (file)
@@ -46,8 +46,6 @@
 #include "net_olsr.h"
 #include "ipcalc.h"
 
-static struct interface *if_ifwithindex(const int if_index);
-
 /* The interface linked-list */
 struct interface *ifnet;
 
@@ -207,7 +205,7 @@ if_ifwithname(const char *if_name)
  *@return return the interface struct representing the interface
  *that matched the iif_index.
  */
-static struct interface *
+struct interface *
 if_ifwithindex(const int if_index)
 {
   struct interface *ifp = ifnet;
index 2585774..ac9fca0 100644 (file)
@@ -198,6 +198,9 @@ if_ifwithname(const char *);
 const char *
 if_ifwithindex_name(const int if_index);
 
+struct interface *
+if_ifwithindex(const int if_index);
+
 struct olsr_if *
 queue_if(const char *, int);
 
index b9ea915..3671088 100644 (file)
@@ -49,7 +49,6 @@
 #define WIN32_LEAN_AND_MEAN
 #include <iprtrmib.h>
 #include <iphlpapi.h>
-#undef interface
 
 char *StrError(unsigned int ErrNo);
 
@@ -65,6 +64,7 @@ int olsr_ioctl_add_route(const struct rt_entry *rt)
   MIB_IPFORWARDROW Row;
   union olsr_ip_addr mask;
   unsigned long Res;
+  struct interface *iface = if_ifwithindex(rt->rt_best->rtp_nexthop.iif_index);
 
   OLSR_PRINTF(2, "KERN: Adding %s\n", olsr_rt_to_string(rt));
 
@@ -86,7 +86,7 @@ int olsr_ioctl_add_route(const struct rt_entry *rt)
   Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
   Row.dwForwardAge = INFINITE;
   Row.dwForwardNextHopAS = 0;
-  Row.dwForwardMetric1 = olsr_fib_metric(&rt->rt_best->rtp_metric);
+  Row.dwForwardMetric1 = iface ? iface->int_metric : 0 + olsr_fib_metric(&rt->rt_best->rtp_metric);
   Row.dwForwardMetric2 = -1;
   Row.dwForwardMetric3 = -1;
   Row.dwForwardMetric4 = -1;
@@ -144,6 +144,7 @@ int olsr_ioctl_del_route(const struct rt_entry *rt)
   MIB_IPFORWARDROW Row;
   union olsr_ip_addr mask;
   unsigned long Res;
+  struct interface *iface = if_ifwithindex(rt->rt_nexthop.iif_index);
 
   OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt));
 
@@ -163,7 +164,7 @@ int olsr_ioctl_del_route(const struct rt_entry *rt)
   Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
   Row.dwForwardAge = INFINITE;
   Row.dwForwardNextHopAS = 0;
-  Row.dwForwardMetric1 = olsr_fib_metric(&rt->rt_metric);
+  Row.dwForwardMetric1 = iface ? iface->int_metric : 0 + olsr_fib_metric(&rt->rt_metric);
   Row.dwForwardMetric2 = -1;
   Row.dwForwardMetric3 = -1;
   Row.dwForwardMetric4 = -1;