diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-12-01 16:40:04 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-12-01 16:40:04 +0300 |
commit | 574912df113888ea19b4811b406612544514d9eb (patch) | |
tree | a7fec6d150d8710b31d4730ef7fab5c4c9ce4417 /accel-pppd/libnetlink | |
parent | 3cc7fd0165e096be25761710b66b44fda9d09190 (diff) | |
parent | e09279c7491a8bd16a25b123e03ddd0cd77b566d (diff) | |
download | accel-ppp-574912df113888ea19b4811b406612544514d9eb.tar.gz accel-ppp-574912df113888ea19b4811b406612544514d9eb.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/accel-ppp/code
Diffstat (limited to 'accel-pppd/libnetlink')
-rw-r--r-- | accel-pppd/libnetlink/genl.c | 6 | ||||
-rw-r--r-- | accel-pppd/libnetlink/ipset.c | 16 | ||||
-rw-r--r-- | accel-pppd/libnetlink/libnetlink.c | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/accel-pppd/libnetlink/genl.c b/accel-pppd/libnetlink/genl.c index 7d745566..68405ba1 100644 --- a/accel-pppd/libnetlink/genl.c +++ b/accel-pppd/libnetlink/genl.c @@ -83,12 +83,12 @@ int __export genl_resolve_mcg(const char *family, const char *name, int *fam_id) if (!tb[CTRL_ATTR_MCAST_GROUPS]) goto out; - + if (fam_id) *fam_id = *(uint32_t *)(RTA_DATA(tb[CTRL_ATTR_FAMILY_ID])); - + parse_rtattr_nested(tb2, GENL_MAX_FAM_GRPS, tb[CTRL_ATTR_MCAST_GROUPS]); - + for (i = 1; i < GENL_MAX_FAM_GRPS; i++) { if (tb2[i]) { parse_rtattr_nested(tb3, CTRL_ATTR_MCAST_GRP_MAX, tb2[i]); diff --git a/accel-pppd/libnetlink/ipset.c b/accel-pppd/libnetlink/ipset.c index 73125352..7834b644 100644 --- a/accel-pppd/libnetlink/ipset.c +++ b/accel-pppd/libnetlink/ipset.c @@ -41,7 +41,7 @@ static int __ipset_cmd(const char *name, in_addr_t addr, int cmd, int flags) log_error("ipset: cannot open rtnetlink\n"); return -1; } - + memset(&req, 0, sizeof(req) - 4096); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); @@ -53,18 +53,18 @@ static int __ipset_cmd(const char *name, in_addr_t addr, int cmd, int flags) addattr_l(&req.n, 4096, IPSET_ATTR_PROTOCOL, &protocol, 1); addattr_l(&req.n, 4096, IPSET_ATTR_SETNAME, name, strlen(name) + 1); - + tail1 = addattr_nest(&req.n, MAX_MSG, IPSET_ATTR_DATA | NLA_F_NESTED); tail2 = addattr_nest(&req.n, MAX_MSG, IPSET_ATTR_IP | NLA_F_NESTED); addattr32(&req.n, 4096, IPSET_ATTR_IPADDR_IPV4 | NLA_F_NET_BYTEORDER, addr); addattr_nest_end(&req.n, tail2); - + addattr_nest_end(&req.n, tail1); - + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) goto out_err; - + rtnl_close(&rth); return 0; @@ -100,7 +100,7 @@ int __export ipset_flush(const char *name) log_error("ipset: cannot open rtnetlink\n"); return -1; } - + memset(&req, 0, sizeof(req) - 4096); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct nfgenmsg)); @@ -112,10 +112,10 @@ int __export ipset_flush(const char *name) addattr_l(&req.n, 4096, IPSET_ATTR_PROTOCOL, &protocol, 1); addattr_l(&req.n, 4096, IPSET_ATTR_SETNAME, name, strlen(name) + 1); - + if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL, 0) < 0) goto out_err; - + rtnl_close(&rth); return 0; diff --git a/accel-pppd/libnetlink/libnetlink.c b/accel-pppd/libnetlink/libnetlink.c index 026df82b..0536783a 100644 --- a/accel-pppd/libnetlink/libnetlink.c +++ b/accel-pppd/libnetlink/libnetlink.c @@ -139,7 +139,7 @@ int __export rtnl_send_check(struct rtnl_handle *rth, const char *buf, int len) struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) log_debug("libnetlink: ""ERROR truncated\n"); - else + else errno = -err->error; return -1; } |