On Wed, Dec 21, 2016 at 12:08:23PM +0100, Jeremie Courreges-Anglas wrote:
> 
> Hi,
> 
> After ospfd here's a diff to make ospf6d refresh his view of an
> interface's MTU at runtime.  This needs a fresh kernel.
> 
> The parent should pass the IFINFO message to its children first, and
> then decide to react to a possible interface change.  Like for ospfd,
> the engine runs the FSM only if the interface state has actually
> changed.
> 
> ok?

Looks like what you did in ospfd. So OK claudio@

> 
> 
> Index: ospf6ctl/ospf6ctl.c
> ===================================================================
> RCS file: /d/cvs/src/usr.sbin/ospf6ctl/ospf6ctl.c,v
> retrieving revision 1.43
> diff -u -p -r1.43 ospf6ctl.c
> --- ospf6ctl/ospf6ctl.c       5 Dec 2015 13:12:40 -0000       1.43
> +++ ospf6ctl/ospf6ctl.c       5 Dec 2016 22:40:53 -0000
> @@ -409,9 +409,10 @@ show_interface_detail_msg(struct imsg *i
>                   iface->name, print_link(iface->flags));
>               printf("  Internet address %s Area %s\n",
>                   log_in6addr(&iface->addr), inet_ntoa(iface->area));
> -             printf("  Link type %s, state %s",
> +             printf("  Link type %s, state %s, mtu %d",
>                   get_media_descr(get_ifms_type(iface->if_type)),
> -                 get_linkstate(iface->if_type, iface->linkstate));
> +                 get_linkstate(iface->if_type, iface->linkstate),
> +                 iface->mtu);
>               if (iface->linkstate != LINK_STATE_DOWN &&
>                   iface->baudrate > 0) {
>                   printf(", ");
> Index: ospf6d/kroute.c
> ===================================================================
> RCS file: /d/cvs/src/usr.sbin/ospf6d/kroute.c,v
> retrieving revision 1.48
> diff -u -p -r1.48 kroute.c
> --- ospf6d/kroute.c   17 Jul 2015 20:12:38 -0000      1.48
> +++ ospf6d/kroute.c   20 Dec 2016 16:09:14 -0000
> @@ -729,12 +729,6 @@ if_change(u_short ifindex, int flags, st
>               return;
>       }
>  
> -     isvalid = (iface->flags & IFF_UP) &&
> -         LINK_STATE_IS_UP(iface->linkstate);
> -
> -     if (wasvalid == isvalid)
> -             return;         /* nothing changed wrt validity */
> -
>       /* inform engine and rde about state change if interface is used */
>       if (iface->cflags & F_IFACE_CONFIGURED) {
>               main_imsg_compose_ospfe(IMSG_IFINFO, 0, iface,
> @@ -742,6 +736,12 @@ if_change(u_short ifindex, int flags, st
>               main_imsg_compose_rde(IMSG_IFINFO, 0, iface,
>                   sizeof(struct iface));
>       }
> +
> +     isvalid = (iface->flags & IFF_UP) &&
> +         LINK_STATE_IS_UP(iface->linkstate);
> +
> +     if (wasvalid == isvalid)
> +             return;         /* nothing changed wrt validity */
>  
>       /* update redistribute list */
>       RB_FOREACH(kr, kroute_tree, &krt) {
> Index: ospf6d/ospfe.c
> ===================================================================
> RCS file: /d/cvs/src/usr.sbin/ospf6d/ospfe.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 ospfe.c
> --- ospf6d/ospfe.c    3 Sep 2016 10:25:36 -0000       1.49
> +++ ospf6d/ospfe.c    21 Dec 2016 10:55:11 -0000
> @@ -260,7 +260,7 @@ ospfe_dispatch_main(int fd, short event,
>       struct imsg              imsg;
>       struct imsgev           *iev = bula;
>       struct imsgbuf          *ibuf = &iev->ibuf;
> -     int                      n, stub_changed, shut = 0;
> +     int                      n, stub_changed, shut = 0, isvalid, wasvalid;
>       unsigned int             ifindex;
>  
>       if (event & EV_READ) {
> @@ -293,11 +293,19 @@ ospfe_dispatch_main(int fd, short event,
>                       if (iface == NULL)
>                               fatalx("interface lost in ospfe");
>  
> +                     wasvalid = (iface->flags & IFF_UP) &&
> +                         LINK_STATE_IS_UP(iface->linkstate);
> +
>                       if_update(iface, ifp->mtu, ifp->flags, ifp->if_type,
>                           ifp->linkstate, ifp->baudrate);
>  
> -                     if ((iface->flags & IFF_UP) &&
> -                         LINK_STATE_IS_UP(iface->linkstate)) {
> +                     isvalid = (iface->flags & IFF_UP) &&
> +                         LINK_STATE_IS_UP(iface->linkstate);
> +
> +                     if (wasvalid == isvalid)
> +                             break;
> +
> +                     if (isvalid) {
>                               if_fsm(iface, IF_EVT_UP);
>                               log_warnx("interface %s up", iface->name);
>                       } else {
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

-- 
:wq Claudio

Reply via email to