diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-01-04 12:45:54 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-01-04 12:45:54 +0000 |
commit | 407fe7c5d6505c84269624ae5deab8865d4ad794 (patch) | |
tree | f43776b6fa323bbbac4ae91008a7be4f6db50456 /usr.sbin/bgpd | |
parent | a6669362db60abcc49ebce18bd1e5a41df6ec2e2 (diff) |
Correctly count the number of allocated BGP attributes. Needs a own counter.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_attr.c | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 197612631e2..11e3d002929 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.183 2006/01/03 22:49:17 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.184 2006/01/04 12:45:53 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -641,6 +641,7 @@ struct rde_memstats { int64_t aspath_refs; int64_t attr_cnt; int64_t attr_data; + int64_t attr_dcnt; }; /* Address Family Numbers as per rfc1700 */ diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c index 9a303cc3d8c..bbc19da8f7d 100644 --- a/usr.sbin/bgpd/rde_attr.c +++ b/usr.sbin/bgpd/rde_attr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_attr.c,v 1.54 2006/01/03 22:49:17 claudio Exp $ */ +/* $OpenBSD: rde_attr.c,v 1.55 2006/01/04 12:45:53 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -84,6 +84,7 @@ attr_optadd(struct rde_aspath *asp, u_int8_t flags, u_int8_t type, if (a->data == NULL) fatal("attr_optadd"); + rdemem.attr_dcnt++; rdemem.attr_data += len; memcpy(a->data, data, len); } else @@ -93,6 +94,8 @@ attr_optadd(struct rde_aspath *asp, u_int8_t flags, u_int8_t type, TAILQ_FOREACH_REVERSE(p, &asp->others, attr_list, entry) { if (type == p->type) { /* attribute allowed only once */ + if (len != 0) + rdemem.attr_dcnt--; rdemem.attr_data -= len; rdemem.attr_cnt--; free(a->data); @@ -139,6 +142,8 @@ attr_optfree(struct rde_aspath *asp) while ((a = TAILQ_FIRST(&asp->others)) != NULL) { TAILQ_REMOVE(&asp->others, a, entry); + if (a->len != 0) + rdemem.attr_dcnt--; rdemem.attr_data -= a->len; rdemem.attr_cnt--; free(a->data); |