diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-07-07 17:47:26 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-07-07 19:33:24 +0200 |
commit | 3832c4f908e6d9d821b18bbccab017b2d3d6c79c (patch) | |
tree | 0fb3bc3956cde0c85db98671146cb503c86a138b /src/e1_input_vty.c | |
parent | 466c5467e2e95c04260cb6b933181a38d1d97bd5 (diff) |
e1_input: add new refcounting scheme to avoid leaking E1 lines
This patch 's/e1inp_line_get/e1inp_line_find/g' since we need this
function name for the new refcounting scheme.
Basically, I have added a new function to clone lines that is used
by the ipaccess driver:
struct e1inp_line *e1inp_line_clone(void *ctx, struct e1inp_line *line);
And two functions to bump and decrement the refcount:
void e1inp_line_get(struct e1inp_line *line);
void e1inp_line_put(struct e1inp_line *line);
This is useful to avoid leaking virtual E1 lines in the ipaccess
case, since we have two sockets for OML and RSL respectively, we
have to release the line *once* both sockets have been closed.
Without this patch, there are cases in which we don't know if it's
time to release the virtual E1 line.
This patch also includes a fix to avoid crashing if we open a
connection with OML/RSL port without sending any ID_RESP message
(in that case, we have no chance to set the signal link). I tested
these situations with netcat.
Diffstat (limited to 'src/e1_input_vty.c')
-rw-r--r-- | src/e1_input_vty.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/e1_input_vty.c b/src/e1_input_vty.c index 55a9951..212a4ac 100644 --- a/src/e1_input_vty.c +++ b/src/e1_input_vty.c @@ -47,7 +47,7 @@ DEFUN(cfg_e1line_driver, cfg_e1_line_driver_cmd, struct e1inp_line *line; int e1_nr = atoi(argv[0]); - line = e1inp_line_get(e1_nr); + line = e1inp_line_find(e1_nr); if (line) { vty_out(vty, "%% Line %d already exists%s", e1_nr, VTY_NEWLINE); return CMD_WARNING; |