Re: ospfd - add metric and type to print_redistribute

2016-12-24 Thread Stefan Sperling
On Fri, Dec 23, 2016 at 11:06:34PM +0100, Jeremie Courreges-Anglas wrote:
> Same diff for ospf6d, ok?

Yes. OK.

> Index: printconf.c
> ===
> RCS file: /d/cvs/src/usr.sbin/ospf6d/printconf.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 printconf.c
> --- printconf.c   22 Aug 2010 21:15:25 -  1.4
> +++ printconf.c   23 Dec 2016 22:04:31 -
> @@ -72,24 +72,27 @@ print_redistribute(struct ospfd_conf *co
>   SIMPLEQ_FOREACH(r, >redist_list, entry) {
>   switch (r->type & ~REDIST_NO) {
>   case REDIST_STATIC:
> - printf("%sredistribute static\n", print_no(r->type));
> + printf("%sredistribute static ", print_no(r->type));
>   break;
>   case REDIST_CONNECTED:
> - printf("%sredistribute connected\n", print_no(r->type));
> + printf("%sredistribute connected ", print_no(r->type));
>   break;
>   case REDIST_LABEL:
> - printf("%sredistribute rtlabel %s\n",
> + printf("%sredistribute rtlabel %s ",
>   print_no(r->type), rtlabel_id2name(r->label));
>   break;
>   case REDIST_ADDR:
> - printf("%sredistribute %s/%d\n",
> + printf("%sredistribute %s/%d ",
>   print_no(r->type), log_in6addr(>addr),
>   r->prefixlen);
>   break;
>   case REDIST_DEFAULT:
> - printf("%sredistribute default\n", print_no(r->type));
> + printf("%sredistribute default ", print_no(r->type));
>   break;
>   }
> + printf("set { metric %d type %d }\n",
> + (r->metric & LSA_METRIC_MASK),
> + ((r->metric & LSA_ASEXT_E_FLAG) == 0 ? 1 : 2));
>   }
>  }
>  
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 



Re: ospfd - add metric and type to print_redistribute

2016-12-23 Thread Jeremie Courreges-Anglas
Claudio Jeker  writes:

> On Sat, Nov 19, 2016 at 11:38:56AM +, Stuart Henderson wrote:
>> On 2016/11/19 10:06, Remi Locherer wrote:
>> > Hi,
>> > 
>> > In the output of ospfd -nv I miss metric and type for the redistribute
>> > statement. The below patch adds this.
>> 
>> OK with me. This prints the values when they're at defaults as well,
>> but I don't think that is a problem.
>> 
>
> Same here. I'm OK with the diff.

Same diff for ospf6d, ok?


Index: printconf.c
===
RCS file: /d/cvs/src/usr.sbin/ospf6d/printconf.c,v
retrieving revision 1.4
diff -u -p -r1.4 printconf.c
--- printconf.c 22 Aug 2010 21:15:25 -  1.4
+++ printconf.c 23 Dec 2016 22:04:31 -
@@ -72,24 +72,27 @@ print_redistribute(struct ospfd_conf *co
SIMPLEQ_FOREACH(r, >redist_list, entry) {
switch (r->type & ~REDIST_NO) {
case REDIST_STATIC:
-   printf("%sredistribute static\n", print_no(r->type));
+   printf("%sredistribute static ", print_no(r->type));
break;
case REDIST_CONNECTED:
-   printf("%sredistribute connected\n", print_no(r->type));
+   printf("%sredistribute connected ", print_no(r->type));
break;
case REDIST_LABEL:
-   printf("%sredistribute rtlabel %s\n",
+   printf("%sredistribute rtlabel %s ",
print_no(r->type), rtlabel_id2name(r->label));
break;
case REDIST_ADDR:
-   printf("%sredistribute %s/%d\n",
+   printf("%sredistribute %s/%d ",
print_no(r->type), log_in6addr(>addr),
r->prefixlen);
break;
case REDIST_DEFAULT:
-   printf("%sredistribute default\n", print_no(r->type));
+   printf("%sredistribute default ", print_no(r->type));
break;
}
+   printf("set { metric %d type %d }\n",
+   (r->metric & LSA_METRIC_MASK),
+   ((r->metric & LSA_ASEXT_E_FLAG) == 0 ? 1 : 2));
}
 }
 


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: ospfd - add metric and type to print_redistribute

2016-11-19 Thread Claudio Jeker
On Sat, Nov 19, 2016 at 11:38:56AM +, Stuart Henderson wrote:
> On 2016/11/19 10:06, Remi Locherer wrote:
> > Hi,
> > 
> > In the output of ospfd -nv I miss metric and type for the redistribute
> > statement. The below patch adds this.
> 
> OK with me. This prints the values when they're at defaults as well,
> but I don't think that is a problem.
> 

Same here. I'm OK with the diff.

-- 
:wq Claudio



Re: ospfd - add metric and type to print_redistribute

2016-11-19 Thread Stuart Henderson
On 2016/11/19 10:06, Remi Locherer wrote:
> Hi,
> 
> In the output of ospfd -nv I miss metric and type for the redistribute
> statement. The below patch adds this.

OK with me. This prints the values when they're at defaults as well,
but I don't think that is a problem.



ospfd - add metric and type to print_redistribute

2016-11-19 Thread Remi Locherer
Hi,

In the output of ospfd -nv I miss metric and type for the redistribute
statement. The below patch adds this.

Sample output:

remi@mistral:..in/ospfd% doas obj/ospfd -nv
WARNING: IP forwarding NOT enabled, running as stub router

router-id 10.10.10.1
fib-update yes
rfc1583compat yes
stub router yes
redistribute rtlabel r1 set { metric 200 type 1 }
^
redistribute rtlabel r2 set { metric 100 type 1 }
^
spf-delay msec 1000
spf-holdtime msec 5000

area 0.0.0.0 {
interface pair0:10.0.0.1 {
metric 500
retransmit-interval 5
router-dead-time 40
hello-interval 10
router-priority 1
transmit-delay 1
auth-type none
}
}


Remi


Index: printconf.c
===
RCS file: /cvs/src/usr.sbin/ospfd/printconf.c,v
retrieving revision 1.16
diff -u -p -r1.16 printconf.c
--- printconf.c 6 Mar 2013 15:43:23 -   1.16
+++ printconf.c 19 Nov 2016 08:46:46 -
@@ -76,24 +76,27 @@ print_redistribute(struct redist_list *r
SIMPLEQ_FOREACH(r, rlh, entry) {
switch (r->type & ~REDIST_NO) {
case REDIST_STATIC:
-   printf("%sredistribute static\n", print_no(r->type));
+   printf("%sredistribute static ", print_no(r->type));
break;
case REDIST_CONNECTED:
-   printf("%sredistribute connected\n", print_no(r->type));
+   printf("%sredistribute connected ", print_no(r->type));
break;
case REDIST_LABEL:
-   printf("%sredistribute rtlabel %s\n",
+   printf("%sredistribute rtlabel %s ",
print_no(r->type), rtlabel_id2name(r->label));
break;
case REDIST_ADDR:
-   printf("%sredistribute %s/%d\n",
+   printf("%sredistribute %s/%d ",
print_no(r->type), inet_ntoa(r->addr),
mask2prefixlen(r->mask.s_addr));
break;
case REDIST_DEFAULT:
-   printf("%sredistribute default\n", print_no(r->type));
+   printf("%sredistribute default ", print_no(r->type));
break;
}
+   printf("set { metric %d type %d }\n",
+   (r->metric & LSA_METRIC_MASK),
+   ((r->metric & LSA_ASEXT_E_FLAG) == 0 ? 1 : 2));
}
 }