From c59aa22028d206819dec54210358a4d63a5aa9ae Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Sun, 5 Jun 2011 12:30:47 +0200 Subject: [PATCH] replace same ds with generic one --- src/xt_user.c | 17 ++++++++++++----- src/xt_user.h | 17 +---------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/xt_user.c b/src/xt_user.c index 9eb31da..75bd651 100644 --- a/src/xt_user.c +++ b/src/xt_user.c @@ -50,7 +50,9 @@ static int userctl_set(struct lananlmsg *lmsg) fb = search_fblock_n(msg->name); if (!fb) return -EINVAL; + ret = fblock_set_option(fb, msg->option); + put_fblock(fb); return ret; @@ -65,6 +67,7 @@ static int userctl_replace(struct lananlmsg *lmsg) fb1 = search_fblock_n(msg->name1); if (!fb1) return -EINVAL; + fb2 = search_fblock_n(msg->name2); if (!fb2) { put_fblock(fb1); @@ -90,6 +93,7 @@ static int userctl_replace(struct lananlmsg *lmsg) unregister_fblock(fb1); ret = register_fblock(fb2, fb2->idp); + put_fblock(fb1); put_fblock(fb2); @@ -100,11 +104,12 @@ static int userctl_subscribe(struct lananlmsg *lmsg) { int ret; struct fblock *fb1, *fb2; - struct lananlmsg_subscribe *msg = (struct lananlmsg_subscribe *) lmsg->buff; + struct lananlmsg_tuple *msg = (struct lananlmsg_tuple *) lmsg->buff; fb1 = search_fblock_n(msg->name1); if (!fb1) return -EINVAL; + fb2 = search_fblock_n(msg->name2); if (!fb2) { put_fblock(fb1); @@ -115,6 +120,7 @@ static int userctl_subscribe(struct lananlmsg *lmsg) * wishes to be notified. */ ret = subscribe_to_remote_fblock(fb2, fb1); + put_fblock(fb1); put_fblock(fb2); @@ -124,12 +130,12 @@ static int userctl_subscribe(struct lananlmsg *lmsg) static int userctl_unsubscribe(struct lananlmsg *lmsg) { struct fblock *fb1, *fb2; - struct lananlmsg_unsubscribe *msg = - (struct lananlmsg_unsubscribe *) lmsg->buff; + struct lananlmsg_tuple *msg = (struct lananlmsg_tuple *) lmsg->buff; fb1 = search_fblock_n(msg->name1); if (!fb1) return -EINVAL; + fb2 = search_fblock_n(msg->name2); if (!fb2) { put_fblock(fb1); @@ -137,6 +143,7 @@ static int userctl_unsubscribe(struct lananlmsg *lmsg) } unsubscribe_from_remote_fblock(fb2, fb1); + put_fblock(fb1); put_fblock(fb2); @@ -168,7 +175,7 @@ static int userctl_bind(struct lananlmsg *lmsg) { int ret; struct fblock *fb1, *fb2; - struct lananlmsg_bind *msg = (struct lananlmsg_bind *) lmsg->buff; + struct lananlmsg_tuple *msg = (struct lananlmsg_tuple *) lmsg->buff; fb1 = search_fblock_n(msg->name1); if (!fb1) @@ -192,7 +199,7 @@ static int userctl_unbind(struct lananlmsg *lmsg) { int ret; struct fblock *fb1, *fb2; - struct lananlmsg_unbind *msg = (struct lananlmsg_unbind *) lmsg->buff; + struct lananlmsg_tuple *msg = (struct lananlmsg_tuple *) lmsg->buff; fb1 = search_fblock_n(msg->name1); if (!fb1) diff --git a/src/xt_user.h b/src/xt_user.h index 60054ee..cb804f4 100644 --- a/src/xt_user.h +++ b/src/xt_user.h @@ -51,12 +51,7 @@ struct lananlmsg_set { char option[USERCTL_BUF_LEN - FBNAMSIZ]; }; -struct lananlmsg_bind { - char name1[FBNAMSIZ]; - char name2[FBNAMSIZ]; -}; - -struct lananlmsg_unbind { +struct lananlmsg_tuple { char name1[FBNAMSIZ]; char name2[FBNAMSIZ]; }; @@ -67,16 +62,6 @@ struct lananlmsg_replace { uint8_t drop_priv; }; -struct lananlmsg_subscribe { - char name1[FBNAMSIZ]; - char name2[FBNAMSIZ]; -}; - -struct lananlmsg_unsubscribe { - char name1[FBNAMSIZ]; - char name2[FBNAMSIZ]; -}; - extern int init_userctl_system(void); extern void cleanup_userctl_system(void); -- 2.11.4.GIT