On Tue, Dec 31, 2019 at 01:47:08PM +0100, Denis Fondras wrote:
> Rename orig_rtr_lsa_area() to orig_rtr_lsa()
>
> Now that area is part of iface, original orig_rtr_lsa() is useless. Also
> verifying that area != NULL is not needed in some cases (these are leftovers
> of
> the previous diff).
>
OK remi@
>
> Index: interface.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/interface.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 interface.c
> --- interface.c 23 Dec 2019 07:33:49 -0000 1.27
> +++ interface.c 31 Dec 2019 12:44:15 -0000
> @@ -144,7 +144,7 @@ if_fsm(struct iface *iface, enum iface_e
>
> if (iface->state != old_state) {
> area_track(iface->area);
> - orig_rtr_lsa(iface);
> + orig_rtr_lsa(iface->area);
> orig_link_lsa(iface);
>
> /* state change inform RDE */
> @@ -395,7 +395,7 @@ if_act_start(struct iface *iface)
>
> if (iface->cflags & F_IFACE_PASSIVE) {
> /* for an update of stub network entries */
> - orig_rtr_lsa(iface);
> + orig_rtr_lsa(iface->area);
> return (0);
> }
>
> @@ -569,7 +569,7 @@ start:
> nbr_fsm(nbr, NBR_EVT_ADJ_OK);
> }
>
> - orig_rtr_lsa(iface);
> + orig_rtr_lsa(iface->area);
> if (iface->state & IF_STA_DR || old_state & IF_STA_DR)
> orig_net_lsa(iface);
> }
> @@ -586,7 +586,7 @@ if_act_reset(struct iface *iface)
>
> if (iface->cflags & F_IFACE_PASSIVE) {
> /* for an update of stub network entries */
> - orig_rtr_lsa(iface);
> + orig_rtr_lsa(iface->area);
> return (0);
> }
>
> Index: neighbor.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/neighbor.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 neighbor.c
> --- neighbor.c 23 Dec 2019 07:33:49 -0000 1.15
> +++ neighbor.c 31 Dec 2019 12:44:15 -0000
> @@ -202,7 +202,7 @@ nbr_fsm(struct nbr *nbr, enum nbr_event
> * neighbor changed from/to FULL
> * originate new rtr and net LSA
> */
> - orig_rtr_lsa(nbr->iface);
> + orig_rtr_lsa(nbr->iface->area);
> if (nbr->iface->state & IF_STA_DR)
> orig_net_lsa(nbr->iface);
>
> @@ -226,7 +226,7 @@ nbr_fsm(struct nbr *nbr, enum nbr_event
> nbr_state_name(nbr->state));
>
> if (nbr->iface->type == IF_TYPE_VIRTUALLINK) {
> - orig_rtr_lsa(nbr->iface);
> + orig_rtr_lsa(nbr->iface->area);
> }
> }
>
> Index: ospf6d.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.c,v
> retrieving revision 1.45
> diff -u -p -r1.45 ospf6d.c
> --- ospf6d.c 16 Dec 2019 08:28:33 -0000 1.45
> +++ ospf6d.c 31 Dec 2019 12:44:15 -0000
> @@ -741,7 +741,7 @@ merge_config(struct ospfd_conf *conf, st
> }
> if (a->dirty) {
> a->dirty = 0;
> - orig_rtr_lsa(LIST_FIRST(&a->iface_list));
> + orig_rtr_lsa(LIST_FIRST(&a->iface_list)->area);
> }
> }
> }
> Index: ospfe.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v
> retrieving revision 1.59
> diff -u -p -r1.59 ospfe.c
> --- ospfe.c 28 Dec 2019 09:25:24 -0000 1.59
> +++ ospfe.c 31 Dec 2019 12:44:15 -0000
> @@ -45,7 +45,6 @@
> void ospfe_sig_handler(int, short, void *);
> __dead void ospfe_shutdown(void);
> void orig_rtr_lsa_all(struct area *);
> -void orig_rtr_lsa_area(struct area *);
> struct iface *find_vlink(struct abr_rtr *);
>
> struct ospfd_conf *oeconf = NULL, *nconf;
> @@ -301,7 +300,7 @@ ospfe_dispatch_main(int fd, short event,
> i->depend_ok =
> ifstate_is_up(ifp);
> if (ifstate_is_up(i))
> - orig_rtr_lsa(i);
> + orig_rtr_lsa(i->area);
> }
> }
> }
> @@ -600,8 +599,6 @@ ospfe_dispatch_rde(int fd, short event,
> * flood on all area interfaces on
> * area 0.0.0.0 include also virtual links.
> */
> - if (nbr->iface->area == NULL)
> - fatalx("interface lost area");
> LIST_FOREACH(iface,
> &nbr->iface->area->iface_list, entry) {
> noack += lsa_flood(iface, nbr,
> @@ -799,19 +796,11 @@ orig_rtr_lsa_all(struct area *area)
> */
> LIST_FOREACH(a, &oeconf->area_list, entry)
> if (a != area)
> - orig_rtr_lsa_area(a);
> + orig_rtr_lsa(a);
> }
>
> void
> -orig_rtr_lsa(struct iface *iface)
> -{
> - if (iface->area == NULL)
> - fatalx("interface lost area");
> - orig_rtr_lsa_area(iface->area);
> -}
> -
> -void
> -orig_rtr_lsa_area(struct area *area)
> +orig_rtr_lsa(struct area *area)
> {
> struct lsa_hdr lsa_hdr;
> struct lsa_rtr lsa_rtr;
> Index: ospfe.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.h,v
> retrieving revision 1.22
> diff -u -p -r1.22 ospfe.h
> --- ospfe.h 28 Dec 2019 09:25:24 -0000 1.22
> +++ ospfe.h 31 Dec 2019 12:44:15 -0000
> @@ -121,7 +121,7 @@ u_int32_t ospfe_router_id(void);
> void ospfe_fib_update(int);
> void ospfe_iface_ctl(struct ctl_conn *, unsigned int);
> void ospfe_nbr_ctl(struct ctl_conn *);
> -void orig_rtr_lsa(struct iface *);
> +void orig_rtr_lsa(struct area *);
> void orig_net_lsa(struct iface *);
> void orig_link_lsa(struct iface *);
> void ospfe_demote_area(struct area *, int);
> Index: rde.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v
> retrieving revision 1.81
> diff -u -p -r1.81 rde.c
> --- rde.c 23 Dec 2019 07:33:49 -0000 1.81
> +++ rde.c 31 Dec 2019 12:44:15 -0000
> @@ -753,8 +753,6 @@ rde_dispatch_parent(int fd, short event,
> if (prev_link_ok == link_ok)
> break;
>
> - if (iface->area == NULL)
> - fatalx("interface lost area");
> orig_intra_area_prefix_lsas(iface->area);
>
> break;
> Index: rde_lsdb.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/rde_lsdb.c,v
> retrieving revision 1.40
> diff -u -p -r1.40 rde_lsdb.c
> --- rde_lsdb.c 23 Dec 2019 07:33:49 -0000 1.40
> +++ rde_lsdb.c 31 Dec 2019 12:44:15 -0000
> @@ -573,11 +573,9 @@ lsa_find(struct iface *iface, u_int16_t
>
> if (LSA_IS_SCOPE_AS(ntohs(type)))
> tree = &asext_tree;
> - else if (LSA_IS_SCOPE_AREA(ntohs(type))) {
> - if (iface->area == NULL)
> - fatalx("interface lost area");
> + else if (LSA_IS_SCOPE_AREA(ntohs(type)))
> tree = &iface->area->lsa_tree;
> - } else if (LSA_IS_SCOPE_LLOCAL(ntohs(type)))
> + else if (LSA_IS_SCOPE_LLOCAL(ntohs(type)))
> tree = &iface->lsa_tree;
> else
> fatalx("unknown scope type");
>