On Mon, Dec 05, 2016 at 06:06:42PM +0100, Remi Locherer wrote:
> On Tue, Nov 29, 2016 at 12:14:40PM +0100, Jeremie Courreges-Anglas wrote:
> > Remi Locherer <[email protected]> writes:
> > 
> > > On Sat, Nov 26, 2016 at 09:39:40AM +0100, Jeremie Courreges-Anglas wrote:
> > >> Remi Locherer <[email protected]> writes:
> > >> 
> > >> > Hi,
> > >> >
> > >> > I ran into problems with mtu sizes on interfaces (gif in my case) and
> > >> > ospfd. mtu was not the same on both sites so adjacency could not be
> > >> > formed. The mtu mismatch is also logged by ospfd.
> > >> >
> > >> > Just changing the MTU with ifconfig is not enough in such a case. I did
> > >> > not want to restart ospfd since that produces an outage. What I did:
> > >> >
> > >> > * ifconfig gif1 down
> > >> > * vi /etc/ospfd.conf -> remove gif1
> > >> > * ospfctl reload
> > >> > * ifconfig gif1 mtu 1380 up
> > >> > * vi /etc/ospfd.conf -> add gif1
> > >> > * ospfctl reload
> > >> >
> > >> > To make this a bit easier I propose the below two patches.
> > >> >
> > >> > The first displays the mtu currently known by ospd with ospfctl. Eg:
> > >> >
> > >> > -----
> > >> > remi@mistral:~% doas /usr/src/usr.sbin/ospfctl/obj/ospfctl sho int iwm0
> > >> >
> > >> > Interface iwm0, line protocol is UP
> > >> >   Internet address 172.18.35.224/24, Area 0.0.0.0
> > >> >   Linkstate active, MTU 1500
> > >> >                     ^^^^^^^^
> > >> >   Router ID 10.10.10.1, network type BROADCAST, cost: 10
> > >> >   Transmit delay is 1 sec(s), state DR, priority 1
> > >> >   Designated Router (ID) 10.10.10.1, interface address 172.18.35.224
> > >> >   Backup Designated Router (ID) 0.0.0.0, interface address 0.0.0.0
> > >> >   Timer intervals configured, hello 10, dead 40, wait 40, retransmit 5
> > >> >     Hello timer due in 00:00:06+345msec
> > >> >     Uptime 00:00:44
> > >> >   Neighbor count is 0, adjacent neighbor count is 0
> > >> > -----
> > >> 
> > >> Makes sense.

I noticed the ospfctl part has been commited. Thanks!

> > >> 
> > >> >
> > >> > The second patch allows ospfd to learn about a changed mtu value (or 
> > >> > other
> > >> > interface configs) with a "ospfctl reload".
> > >> >
> > >> > Would it be better if an mtu change generates a route message that is
> > >> > picked up by ospfd the same way as other changes to interfaces configs?
> > >> 
> > >> I think so.  Does the diff below work for you?
> > >> 
> > >
> > > Yes this works. With that I can just fix the mtu without reloading ospfd.
> > > Nice!
> > 
> > Thanks for confirming.  There's one thing that bugs me when I change the
> > mtu on an interface:
> > 
> > if_fsm: interface vether0, event UP not expected in state WAIT
> > interface vether0 up
> > if_fsm: interface vether0, event UP not expected in state WAIT
> > interface vether0 up
> > 
> > "not expected" or "really, should not happen"?  Maybe this routing
> > message (or the one that could be sent for SIOCSIFXFLAGS) is breaking
> > some kind of assumption here?  Input welcome.
> 
> Sorry to not reply any sooner.
> 
> The message is generated by if_fsm in interface.c. I found Claudio's
> drawing from the interface state machine here:
> https://www.openbsd.org/papers/eurobsd2005/claudio/mgp00015.html
> 
> If the mtu is changed while OSPF is running state machine has no definition
> for handling the event IF_EVT_UP. This additional patch teachs ospfd that
> no action is required in this situation.
> 
> The message is now:
> if_fsm: event UP resulted in action NOTHING and changing state for interface 
> pair0 from DR to DR
> interface pair0 up
> 
> I checked what a Brocade FastIron router does when the mtu (ip mtu) changes
> after the ospf adjacency has been formed: nothing.

Any opinions about the patch to generate route messages when the mtu
changes and the change to the ospf interface state machine?

For convenience again the patches:


Index: if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.465
diff -u -p -r1.465 if.c
--- if.c        12 Dec 2016 09:51:30 -0000      1.465
+++ if.c        12 Dec 2016 22:32:04 -0000
@@ -1886,6 +1886,8 @@ ifioctl(struct socket *so, u_long cmd, c
                if (ifp->if_ioctl == NULL)
                        return (EOPNOTSUPP);
                error = (*ifp->if_ioctl)(ifp, cmd, data);
+               if (!error)
+                       rt_ifmsg(ifp);
                break;
 
        case SIOCSIFPHYADDR:
Index: usr.sbin/ospfd/interface.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/interface.c,v
retrieving revision 1.81
diff -u -p -r1.81 interface.c
--- usr.sbin/ospfd/interface.c  5 Dec 2015 12:20:13 -0000       1.81
+++ usr.sbin/ospfd/interface.c  12 Dec 2016 07:27:35 -0000
@@ -55,6 +55,8 @@ struct {
 } iface_fsm[] = {
     /* current state   event that happened     action to take  resulting state 
*/
     {IF_STA_DOWN,      IF_EVT_UP,              IF_ACT_STRT,    0},
+    {IF_STA_WAITING,   IF_EVT_UP,              IF_ACT_NOTHING, 0},
+    {IF_STA_MULTI,     IF_EVT_UP,              IF_ACT_NOTHING, 0},
     {IF_STA_WAITING,   IF_EVT_BACKUP_SEEN,     IF_ACT_ELECT,   0},
     {IF_STA_WAITING,   IF_EVT_WTIMER,          IF_ACT_ELECT,   0},
     {IF_STA_ANY,       IF_EVT_WTIMER,          IF_ACT_NOTHING, 0},
Index: usr.sbin/ospfd/ospfe.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/ospfe.c,v
retrieving revision 1.96
diff -u -p -r1.96 ospfe.c
--- usr.sbin/ospfd/ospfe.c      3 Sep 2016 10:22:57 -0000       1.96
+++ usr.sbin/ospfd/ospfe.c      12 Dec 2016 07:27:35 -0000
@@ -318,6 +318,7 @@ ospfe_dispatch_main(int fd, short event,
                                                iface->flags = kif->flags;
                                                iface->linkstate =
                                                    kif->link_state;
+                                               iface->mtu = kif->mtu;
 
                                                if (link_ok) {
                                                        if_fsm(iface,

Reply via email to