diff -Nur olsrd-0.5.3.orig/lib/httpinfo/src/admin_interface.c olsrd-0.5.3/lib/httpinfo/src/admin_interface.c
--- olsrd-0.5.3.orig/lib/httpinfo/src/admin_interface.c	2007-09-04 16:00:12.000000000 +0200
+++ olsrd-0.5.3/lib/httpinfo/src/admin_interface.c	2007-09-04 16:00:12.000000000 +0200
@@ -123,6 +123,8 @@
 		      "LQ level:", "lq_level", 1, olsr_cnf->lq_level);
       size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int,
 		      "LQ winsize:", "lq_wsize", 2, olsr_cnf->lq_wsize);
+      size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
+		      "NAT thresh:", "lq_nat_thresh", 4, olsr_cnf->lq_nat_thresh);
     }
   else
     {
@@ -253,6 +255,17 @@
       return 1;
     }
 
+  if(!strcmp(key, "lq_nat_thresh"))
+    {
+      float fval = 1.0;
+      sscanf(value, "%f", &fval);
+      if((fval < 0.1) || (fval > 1.0))
+	return -1;
+
+      olsr_cnf->lq_nat_thresh = fval;
+      return 1;
+    }
+
   if(!strcmp(key, "hyst_scaling"))
     {
       float fval = 1.1;
@@ -260,7 +273,6 @@
       if((fval < 0.0) || (fval > 1.0))
 	return -1;
 
-      printf("HYST SCALING: %f\n", fval);
       olsr_cnf->hysteresis_param.scaling = fval;
       return 1;
     }
diff -Nur olsrd-0.5.3.orig/lib/httpinfo/src/olsrd_httpinfo.c olsrd-0.5.3/lib/httpinfo/src/olsrd_httpinfo.c
--- olsrd-0.5.3.orig/lib/httpinfo/src/olsrd_httpinfo.c	2007-07-15 23:09:37.000000000 +0200
+++ olsrd-0.5.3/lib/httpinfo/src/olsrd_httpinfo.c	2007-09-04 16:00:12.000000000 +0200
@@ -872,6 +872,8 @@
       {
         size += snprintf(&buf[size], bufsize-size, "<td>LQ level: %d</td>\n", olsr_cnf->lq_level);
         size += snprintf(&buf[size], bufsize-size, "<td>LQ winsize: %d</td>\n", olsr_cnf->lq_wsize);
+        size += snprintf(&buf[size], bufsize-size, "<td>NAT thresh: %f</td>\n", olsr_cnf->lq_nat_thresh);
+        size += snprintf(&buf[size], bufsize-size, "<td>LQ midopt: %s</td>\n", olsr_cnf->lq_midopt ? "Enabled" : "Disabled");
       }
 
     size += snprintf(&buf[size], bufsize-size, "</tr></table>\n");
diff -Nur olsrd-0.5.3.orig/src/cfgparser/cfgfile_gen.c olsrd-0.5.3/src/cfgparser/cfgfile_gen.c
--- olsrd-0.5.3.orig/src/cfgparser/cfgfile_gen.c	2007-03-27 05:05:21.000000000 +0200
+++ olsrd-0.5.3/src/cfgparser/cfgfile_gen.c	2007-09-04 16:00:12.000000000 +0200
@@ -200,6 +200,12 @@
   fprintf(fd, "# Link quality window size\n\n");
   fprintf(fd, "LinkQualityWinSize\t%d\n\n", cnf->lq_wsize);
 
+  fprintf(fd, "# NAT threshold\n\n");
+  fprintf(fd, "NatThreshold\t%f\n\n", cnf->lq_nat_thresh);
+
+  fprintf(fd, "# LQ midopt\n\n");
+  fprintf(fd, "LinkQualityMidOpt\t%s\n\n", cnf->lq_midopt ? "yes" : "no");
+
   fprintf(fd, "# Clear screen when printing debug output?\n\n");
   fprintf(fd, "ClearScreen\t%s\n\n", cnf->clear_screen ? "yes" : "no");
 
@@ -312,7 +318,11 @@
 		  inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf,
 			    sizeof (ipv6_buf));
 		  
-		  fprintf(fd, "    LinkQualityMult\t%s %0.2f\n",
+		  if(mult->hna_only)
+		    fprintf(fd, "    HnaQualityMult\t%s %0.2f\n",
+			  ipv6_buf, mult->val);
+		  else
+		    fprintf(fd, "    LinkQualityMult\t%s %0.2f\n",
 			  ipv6_buf, mult->val);
 		  
 		  mult = mult->next;
@@ -502,6 +512,12 @@
   WRITE_TO_BUF("# Link quality window size\n\n")
   WRITE_TO_BUF("LinkQualityWinSize\t%d\n\n", cnf->lq_wsize)
 
+  WRITE_TO_BUF("# NAT threshold\n\n")
+  WRITE_TO_BUF("NatThreshold\t%f\n\n", cnf->lq_nat_thresh)
+
+  WRITE_TO_BUF("# LQ midopt\n\n")
+  WRITE_TO_BUF("LinkQualityMidOpt\t%s\n\n", cnf->lq_midopt ? "yes" : "no")
+
   WRITE_TO_BUF("# Clear screen when printing debug output?\n\n")
   WRITE_TO_BUF("ClearScreen\t%s\n\n", cnf->clear_screen ? "yes" : "no")
 
@@ -625,8 +641,12 @@
 		{
 		  inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf,
 			    sizeof (ipv6_buf));
-		  
-		  WRITE_TO_BUF("    LinkQualityMult\t%s %0.2f\n",
+
+		  if(mult->hna_only)
+		    WRITE_TO_BUF("    HnaQualityMult\t%s %0.2f\n",
+			  ipv6_buf, mult->val)
+		  else
+		    WRITE_TO_BUF("    LinkQualityMult\t%s %0.2f\n",
 			  ipv6_buf, mult->val)
 		  
 		  mult = mult->next;
diff -Nur olsrd-0.5.3.orig/src/cfgparser/olsrd_conf.c olsrd-0.5.3/src/cfgparser/olsrd_conf.c
--- olsrd-0.5.3.orig/src/cfgparser/olsrd_conf.c	2007-05-14 00:23:55.000000000 +0200
+++ olsrd-0.5.3/src/cfgparser/olsrd_conf.c	2007-09-04 16:00:12.000000000 +0200
@@ -293,6 +293,13 @@
       return -1;
     }
 
+  /* NAT threshold value */
+  if(cnf->lq_level && (cnf->lq_nat_thresh < 0.1 || cnf->lq_nat_thresh > 1.0))
+    {
+      fprintf(stderr, "NAT threshold %f is not allowed\n", cnf->lq_nat_thresh);
+      return -1;
+    }
+
   if(in == NULL)
     {
       fprintf(stderr, "No interfaces configured!\n");
@@ -465,6 +472,8 @@
     cnf->lq_dlimit = DEF_LQ_DIJK_LIMIT;
     cnf->lq_dinter = DEF_LQ_DIJK_INTER;
     cnf->lq_wsize = DEF_LQ_WSIZE;
+    cnf->lq_nat_thresh = DEF_LQ_NAT_THRESH;
+    cnf->lq_midopt = DEF_LQ_MIDOPT;
     cnf->clear_screen = DEF_CLEAR_SCREEN;
 
     cnf->del_gws = OLSR_FALSE;
@@ -589,6 +598,10 @@
 
   printf("LQ window size   : %d\n", cnf->lq_wsize);
 
+  printf("NAT threshold    : %f\n", cnf->lq_nat_thresh);
+
+  printf("LQ midopt        : %s\n", cnf->lq_midopt ? "yes" : "no");
+
   printf("Clear screen     : %s\n", cnf->clear_screen ? "yes" : "no");
 
   /* Interfaces */
@@ -626,7 +639,11 @@
             inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf,
                       sizeof (ipv6_buf));
 
-            printf("\tLinkQualityMult          : %s %0.2f\n",
+            if (mult->hna_only)
+              printf("\tHnaQualityMult          : %s %0.2f\n",
+                   ipv6_buf, mult->val);
+            else
+              printf("\tLinkQualityMult          : %s %0.2f\n",
                    ipv6_buf, mult->val);
           }
 
diff -Nur olsrd-0.5.3.orig/src/cfgparser/oparse.y olsrd-0.5.3/src/cfgparser/oparse.y
--- olsrd-0.5.3.orig/src/cfgparser/oparse.y	2007-05-13 23:49:59.000000000 +0200
+++ olsrd-0.5.3/src/cfgparser/oparse.y	2007-09-04 16:00:12.000000000 +0200
@@ -68,9 +68,9 @@
 
 static int ifs_in_curr_cfg = 0;
 
-static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg);
+static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg, olsr_bool hna_only);
 
-static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg)
+static int lq_mult_helper(YYSTYPE ip_addr_arg, YYSTYPE mult_arg, olsr_bool hna_only)
 {
   union olsr_ip_addr addr;
   int i;
@@ -78,7 +78,12 @@
   struct olsr_lq_mult *mult;
 
 #if PARSER_DEBUG > 0
-  printf("\tLinkQualityMult %s %0.2f\n",
+  if(hna_only)
+    printf("\tHnaQualityMult %s %0.2f\n",
+         (ip_addr_arg != NULL) ? ip_addr_arg->string : "any",
+         mult_arg->floating);
+  else
+    printf("\tLinkQualityMult %s %0.2f\n",
          (ip_addr_arg != NULL) ? ip_addr_arg->string : "any",
          mult_arg->floating);
 #endif
@@ -106,6 +111,7 @@
 
     memcpy(&mult->addr, &addr, sizeof (union olsr_ip_addr));
     mult->val = mult_arg->floating;
+    mult->hna_only = hna_only;
 
     mult->next = walker->cnf->lq_mult;
     walker->cnf->lq_mult = mult;
@@ -157,7 +163,10 @@
 %token TOK_LQ_FISH
 %token TOK_LQ_DLIMIT
 %token TOK_LQ_WSIZE
+%token TOK_LQ_NAT_THRESH
+%token TOK_LQ_MIDOPT
 %token TOK_LQ_MULT
+%token TOK_HNA_MULT
 %token TOK_CLEAR_SCREEN
 %token TOK_PLPARAM
 
@@ -210,6 +219,8 @@
           | alq_fish
           | alq_dlimit
           | alq_wsize
+          | anat_thresh
+          | alq_midopt
           | bclear_screen
           | vcomment
 ;
@@ -281,6 +292,7 @@
              | isethnaval
              | isetautodetchg
              | isetlqmult
+             | isethnamult
 ;
 
 plbody:     TOK_OPEN plstmts TOK_CLOSE
@@ -655,23 +667,41 @@
 
 isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT
 {
-  if (lq_mult_helper($2, $3) < 0)
+  if (lq_mult_helper($2, $3, OLSR_FALSE) < 0)
     YYABORT;
 }
 
           | TOK_LQ_MULT TOK_IP4_ADDR TOK_FLOAT
 {
-  if (lq_mult_helper($2, $3) < 0)
+  if (lq_mult_helper($2, $3, OLSR_FALSE) < 0)
     YYABORT;
 }
 
           | TOK_LQ_MULT TOK_IP6_ADDR TOK_FLOAT
 {
-  if (lq_mult_helper($2, $3) < 0)
+  if (lq_mult_helper($2, $3, OLSR_FALSE) < 0)
     YYABORT;
 }
+;
 
-          ;
+isethnamult: TOK_HNA_MULT TOK_DEFAULT TOK_FLOAT
+{
+  if (lq_mult_helper($2, $3, OLSR_TRUE) < 0)
+    YYABORT;
+}
+
+          | TOK_HNA_MULT TOK_IP4_ADDR TOK_FLOAT
+{
+  if (lq_mult_helper($2, $3, OLSR_TRUE) < 0)
+    YYABORT;
+}
+
+          | TOK_HNA_MULT TOK_IP6_ADDR TOK_FLOAT
+{
+  if (lq_mult_helper($2, $3, OLSR_TRUE) < 0)
+    YYABORT;
+}
+;
 
 idebug:       TOK_DEBUGLEVEL TOK_INTEGER
 {
@@ -958,6 +988,22 @@
 }
 ;
 
+anat_thresh: TOK_LQ_NAT_THRESH TOK_FLOAT
+{
+  PARSER_DEBUG_PRINTF("NAT threshold %0.2f\n", $2->floating);
+  cnf->lq_nat_thresh = $2->floating;
+  free($2);
+}
+;
+
+alq_midopt: TOK_LQ_MIDOPT TOK_BOOLEAN
+{
+  cnf->lq_midopt = $2->boolean;
+  PARSER_DEBUG_PRINTF("LQ midopt %s\n", cnf->lq_midopt ? "enabled" : "disabled");
+  free($2);
+}
+;
+
 bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN
 {
   cnf->clear_screen = $2->boolean;
diff -Nur olsrd-0.5.3.orig/src/cfgparser/oscan.lex olsrd-0.5.3/src/cfgparser/oscan.lex
--- olsrd-0.5.3.orig/src/cfgparser/oscan.lex	2007-05-17 22:35:16.000000000 +0200
+++ olsrd-0.5.3/src/cfgparser/oscan.lex	2007-09-04 16:00:12.000000000 +0200
@@ -365,11 +365,26 @@
     return TOK_LQ_WSIZE;
 }
 
+"NatThreshold" {
+    yylval = NULL;
+    return TOK_LQ_NAT_THRESH;
+}
+
+"LinkQualityMidOpt" {
+    yylval = NULL;
+    return TOK_LQ_MIDOPT;
+}
+
 "LinkQualityMult" {
     yylval = NULL;
     return TOK_LQ_MULT;
 }
 
+"HnaQualityMult" {
+    yylval = NULL;
+    return TOK_HNA_MULT;
+}
+
 "ClearScreen" {
     yylval = NULL;
     return TOK_CLEAR_SCREEN;
diff -Nur olsrd-0.5.3.orig/src/main.c olsrd-0.5.3/src/main.c
--- olsrd-0.5.3.orig/src/main.c	2007-05-09 01:10:37.000000000 +0200
+++ olsrd-0.5.3/src/main.c	2007-09-04 16:00:12.000000000 +0200
@@ -511,7 +511,7 @@
           "An error occured somwhere between your keyboard and your chair!\n"
           "usage: olsrd [-f <configfile>] [ -i interface1 interface2 ... ]\n"
           "  [-d <debug_level>] [-ipv6] [-multi <IPv6 multicast address>]\n"
-          "  [-lql <LQ level>] [-lqw <LQ winsize>]\n"
+          "  [-lql <LQ lev>] [-lqw <LQ win>] [-lqnt <nat thresh>] [-lqmid]\n"
           "  [-bcast <broadcastaddr>] [-ipc] [-dispin] [-dispout] [-delgw]\n"
           "  [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n"
           "  [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n"
@@ -654,6 +654,36 @@
 	}
       
       /*
+       * Set NAT threshold
+       */
+      if (strcmp(*argv, "-lqnt") == 0) 
+	{
+	  float tmp_lq_nat_thresh;
+	  NEXT_ARG;
+          CHECK_ARGC;
+
+	  sscanf(*argv,"%f", &tmp_lq_nat_thresh);
+
+	  if(tmp_lq_nat_thresh < 0.1 || tmp_lq_nat_thresh > 1.0)
+	    {
+	      printf("NAT threshold %f not allowed. Range [%f-%f]\n", 
+		     tmp_lq_nat_thresh, 0.1, 1.0);
+	      olsr_exit(__func__, EXIT_FAILURE);
+	    }
+	  olsr_cnf->lq_nat_thresh = tmp_lq_nat_thresh;
+	  continue;
+	}
+
+      /*
+       * Set LQ midopt
+       */
+      if (strcmp(*argv, "-lqmid") == 0) 
+	{
+	  cnf->lq_midopt = OLSR_TRUE;
+	  continue;
+	}
+
+      /*
        * Enable additional debugging information to be logged.
        */
       if (strcmp(*argv, "-d") == 0) 
diff -Nur olsrd-0.5.3.orig/src/olsr_cfg.h olsrd-0.5.3/src/olsr_cfg.h
--- olsrd-0.5.3.orig/src/olsr_cfg.h	2007-05-14 00:23:55.000000000 +0200
+++ olsrd-0.5.3/src/olsr_cfg.h	2007-09-04 16:00:12.000000000 +0200
@@ -59,6 +59,8 @@
 #define DEF_LQ_DIJK_LIMIT   255
 #define DEF_LQ_DIJK_INTER   0.0
 #define DEF_LQ_WSIZE        10
+#define DEF_LQ_NAT_THRESH   1.0
+#define DEF_LQ_MIDOPT       OLSR_TRUE
 #define DEF_CLEAR_SCREEN    OLSR_FALSE
 
 /* Bounds */
@@ -102,6 +104,7 @@
 {
   union olsr_ip_addr addr;
   float val;
+  olsr_bool hna_only;
   struct olsr_lq_mult *next;
 };
 
@@ -213,6 +216,8 @@
   olsr_bool                clear_screen;
   olsr_u8_t                lq_level;
   olsr_u32_t               lq_wsize;
+  float                    lq_nat_thresh;
+  olsr_bool                lq_midopt;
   olsr_u8_t                lq_fish;
   olsr_u8_t                lq_dlimit;
   float                    lq_dinter;
