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.
>
> >
> > 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!
>
> Index: sys/net/if.c
> ===================================================================
> RCS file: /d/cvs/src/sys/net/if.c,v
> retrieving revision 1.462
> diff -u -p -r1.462 if.c
> --- sys/net/if.c 21 Nov 2016 09:09:06 -0000 1.462
> +++ sys/net/if.c 26 Nov 2016 08:26:08 -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/ospfctl/ospfctl.c
> ===================================================================
> RCS file: /d/cvs/src/usr.sbin/ospfctl/ospfctl.c,v
> retrieving revision 1.63
> diff -u -p -r1.63 ospfctl.c
> --- usr.sbin/ospfctl/ospfctl.c 3 Dec 2015 11:42:14 -0000 1.63
> +++ usr.sbin/ospfctl/ospfctl.c 26 Nov 2016 08:23:52 -0000
> @@ -434,8 +434,9 @@ show_interface_detail_msg(struct imsg *i
> inet_ntoa(iface->addr),
> mask2prefixlen(iface->mask.s_addr));
> printf("Area %s\n", inet_ntoa(iface->area));
> - printf(" Linkstate %s\n",
> + printf(" Linkstate %s,",
> get_linkstate(iface->if_type, iface->linkstate));
> + printf(" MTU %d\n", iface->mtu);
> printf(" Router ID %s, network type %s, cost: %d\n",
> inet_ntoa(iface->rtr_id),
> if_type_name(iface->type), iface->metric);
> Index: usr.sbin/ospfd/ospfe.c
> ===================================================================
> RCS file: /d/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 26 Nov 2016 08:30:34 -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,
>
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE