On Thu, Apr 28, 2011 at 11:02:40AM -0500, falz wrote:
> On Thu, Apr 28, 2011 at 10:41 AM, falz <[email protected]> wrote:
> > Martin Hein wrote:
> >>
> >> network 10.171.0.0/19 set { localpref 140 metric 12 community 65000:666 }
> >
> > I did test this before but only with a bgpctl reload. I've retested
> > this above with fully stopping and starting bgpd and it does then
> > work. Is there no graceful way to do this? Seems odd that bgpd has to
> > completely stop to change settings on network statements. `bgpctl
> > network` doesn't seem to have any type of refresh, just add and flush.
> > Is there just some command that I'm missing?
> 
> Ok, I see that I can use `bgpctl network delete/add x.x.x.x/yy
> localpref 140`.. and so on and it works. deleting and re-adding it
> doesn't seem to read from the config. Doing this should work but may
> get messy keeping the config in sync manually. Is there any other way?
> 

How about testing this diff instead. I think it should solve the missing
filter updates. It compiles but I did not have the time to test it myself
but I think it should work.

-- 
:wq Claudio

Index: bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
retrieving revision 1.263
diff -u -p -r1.263 bgpd.h
--- bgpd.h      24 Oct 2010 17:20:08 -0000      1.263
+++ bgpd.h      28 Apr 2011 17:56:52 -0000
@@ -931,6 +931,8 @@ void                 pftable_ref(u_int16_t);
 /* rde_filter.c */
 void            filterset_free(struct filter_set_head *);
 int             filterset_cmp(struct filter_set *, struct filter_set *);
+void            filterset_move(struct filter_set_head *,
+                   struct filter_set_head *);
 const char     *filterset_name(enum action_types);
 
 /* util.c */
Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/kroute.c,v
retrieving revision 1.187
diff -u -p -r1.187 kroute.c
--- kroute.c    7 Mar 2011 07:43:02 -0000       1.187
+++ kroute.c    28 Apr 2011 17:57:16 -0000
@@ -1155,6 +1155,8 @@ kr_net_reload(u_int rtableid, struct net
                xn = kr_net_find(kt, n);
                if (xn) {
                        xn->net.old = 0;
+                       filterset_free(&xn->net.attrset);
+                       filterset_move(&n->net.attrset, &xn->net.attrset);
                        kr_net_delete(n);
                } else
                        TAILQ_INSERT_TAIL(&kt->krn, n, entry);
Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.258
diff -u -p -r1.258 parse.y
--- parse.y     2 Sep 2010 14:03:21 -0000       1.258
+++ parse.y     28 Apr 2011 17:58:22 -0000
@@ -126,8 +126,6 @@ int          neighbor_consistent(struct peer *)
 int             merge_filterset(struct filter_set_head *, struct filter_set *);
 void            copy_filterset(struct filter_set_head *,
                    struct filter_set_head *);
-void            move_filterset(struct filter_set_head *,
-                   struct filter_set_head *);
 struct filter_rule     *get_rule(enum action_types);
 
 int             getcommunity(char *);
@@ -608,7 +606,7 @@ network             : NETWORK prefix filter_set     {
                        memcpy(&n->net.prefix, &$2.prefix,
                            sizeof(n->net.prefix));
                        n->net.prefixlen = $2.len;
-                       move_filterset($3, &n->net.attrset);
+                       filterset_move($3, &n->net.attrset);
                        free($3);
 
                        TAILQ_INSERT_TAIL(netconf, n, entry);
@@ -626,7 +624,7 @@ network             : NETWORK prefix filter_set     {
                                YYERROR;
                        }
                        n->net.type = $3 ? NETWORK_STATIC : NETWORK_CONNECTED;
-                       move_filterset($4, &n->net.attrset);
+                       filterset_move($4, &n->net.attrset);
                        free($4);
 
                        TAILQ_INSERT_TAIL(netconf, n, entry);
@@ -3462,22 +3460,6 @@ copy_filterset(struct filter_set_head *s
                        fatal(NULL);
                memcpy(t, s, sizeof(struct filter_set));
                TAILQ_INSERT_TAIL(dest, t, entry);
-       }
-}
-
-void
-move_filterset(struct filter_set_head *source, struct filter_set_head *dest)
-{
-       struct filter_set       *s;
-
-       TAILQ_INIT(dest);
-
-       if (source == NULL)
-               return;
-
-       while ((s = TAILQ_FIRST(source)) != NULL) {
-               TAILQ_REMOVE(source, s, entry);
-               TAILQ_INSERT_TAIL(dest, s, entry);
        }
 }
 
Index: rde_filter.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_filter.c,v
retrieving revision 1.65
diff -u -p -r1.65 rde_filter.c
--- rde_filter.c        29 Nov 2010 17:02:41 -0000      1.65
+++ rde_filter.c        28 Apr 2011 17:58:05 -0000
@@ -516,6 +516,22 @@ filterset_cmp(struct filter_set *a, stru
        return (0);
 }
 
+void
+filterset_move(struct filter_set_head *source, struct filter_set_head *dest)
+{
+       struct filter_set       *s;
+
+       TAILQ_INIT(dest);
+
+       if (source == NULL)
+               return;
+
+       while ((s = TAILQ_FIRST(source)) != NULL) {
+               TAILQ_REMOVE(source, s, entry);
+               TAILQ_INSERT_TAIL(dest, s, entry);
+       }
+}
+
 int
 filterset_equal(struct filter_set_head *ah, struct filter_set_head *bh)
 {

Reply via email to