On Tue, Nov 03, 2015 at 10:09:49PM +0100, Alexander Bluhm wrote:
> On Tue, Nov 03, 2015 at 09:40:38PM +0100, Alexandr Nedvedicky wrote:
> > I think the
> > right thing is to use goto _skip; in that branch to avoid 499 et. al.
> > completely.
>
> Yes
>
> > @@ -491,6 +491,7 @@ pfr_set_addrs(struct pfr_table *tbl, str
> > if (pfr_route_kentry(tmpkt, p)) {
> > pfr_destroy_kentry(p);
> > ad.pfra_fback = PFR_FB_NONE;
> > + goto _skip;
> > } else {
> > SLIST_INSERT_HEAD(&addq, p, pfrke_workq);
> > ad.pfra_fback = PFR_FB_ADDED;
>
> I would prefer not to have an else block after a goto. You can
> remove the else and move the tree following lines one tab to the
> left.
makes sense to me. So this is the patch I'm going to commit.
thanks and
regards
sasha
--------8<---------------8<-----------------8<--------
Index: pf_table.c
===================================================================
RCS file: /cvs/src/sys/net/pf_table.c,v
retrieving revision 1.115
diff -u -p -r1.115 pf_table.c
--- pf_table.c 7 Oct 2015 11:57:44 -0000 1.115
+++ pf_table.c 3 Nov 2015 21:23:49 -0000
@@ -491,11 +491,11 @@ pfr_set_addrs(struct pfr_table *tbl, str
if (pfr_route_kentry(tmpkt, p)) {
pfr_destroy_kentry(p);
ad.pfra_fback = PFR_FB_NONE;
- } else {
- SLIST_INSERT_HEAD(&addq, p, pfrke_workq);
- ad.pfra_fback = PFR_FB_ADDED;
- xadd++;
+ goto _skip;
}
+ SLIST_INSERT_HEAD(&addq, p, pfrke_workq);
+ ad.pfra_fback = PFR_FB_ADDED;
+ xadd++;
if (p->pfrke_type == PFRKE_COST)
kt->pfrkt_refcntcost++;
pfr_ktable_winfo_update(kt, p);