diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-10-09 16:45:09 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-10-09 16:45:09 +0300 |
commit | be1d17967961af52936d177bb5e426bc2a6b6ef0 (patch) | |
tree | a87587f414f7f81ad9bcfd564133dcc7e99b4943 | |
parent | 09f0f8ffe2671854ed64423c4414cdb0c029cf15 (diff) | |
download | accel-ppp-be1d17967961af52936d177bb5e426bc2a6b6ef0.tar.gz accel-ppp-be1d17967961af52936d177bb5e426bc2a6b6ef0.zip |
ipoe: more verbose netlink errors
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe_netlink.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe_netlink.c b/accel-pppd/ctrl/ipoe/ipoe_netlink.c index 54a5423a..45020727 100644 --- a/accel-pppd/ctrl/ipoe/ipoe_netlink.c +++ b/accel-pppd/ctrl/ipoe/ipoe_netlink.c @@ -58,7 +58,7 @@ int ipoe_nl_add_exclude(uint32_t addr, int mask) addattr32(nlh, 1024, IPOE_ATTR_ADDR, addr); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) { - log_ppp_error("ipoe: nl_add_net: error talking to kernel\n"); + log_ppp_error("ipoe: nl_add_exclude: %s\n", strerror(errno)); ret = -1; } @@ -93,7 +93,7 @@ void ipoe_nl_del_exclude(uint32_t addr) addattr32(nlh, 1024, IPOE_ATTR_ADDR, addr); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) - log_ppp_error("ipoe: nl_add_net: error talking to kernel\n"); + log_ppp_error("ipoe: nl_del_exclude: %s\n", strerror(errno)); rtnl_close(&rth); } @@ -128,7 +128,7 @@ int ipoe_nl_add_net(uint32_t addr, int mask) addattr32(nlh, 1024, IPOE_ATTR_MASK, mask); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) { - log_ppp_error("ipoe: nl_add_net: error talking to kernel\n"); + log_ppp_error("ipoe: nl_add_net: %s\n", strerror(errno)); ret = -1; } @@ -163,7 +163,7 @@ void ipoe_nl_del_net(uint32_t addr) addattr32(nlh, 1024, IPOE_ATTR_ADDR, addr); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) - log_ppp_error("ipoe: nl_del_net: error talking to kernel\n"); + log_ppp_error("ipoe: nl_del_net: %s\n", strerror(errno)); rtnl_close(&rth); } @@ -195,7 +195,7 @@ void ipoe_nl_add_interface(int ifindex, uint8_t mode) addattr_l(nlh, 1024, IPOE_ATTR_MODE, &mode, 1); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) - log_error("ipoe: nl_add_iface: error talking to kernel\n"); + log_error("ipoe: nl_add_iface: %s\n", strerror(errno)); rtnl_close(&rth); } @@ -226,7 +226,7 @@ void ipoe_nl_del_interface(int ifindex) addattr32(nlh, 1024, IPOE_ATTR_IFINDEX, ifindex); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) - log_error("ipoe: nl_del_iface: error talking to kernel\n"); + log_error("ipoe: nl_del_iface: %s\n", strerror(errno)); rtnl_close(&rth); } @@ -265,8 +265,10 @@ int ipoe_nl_create(int ifindex) addattr32(nlh, 1024, IPOE_ATTR_IFINDEX, ifindex); - if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) - log_ppp_error("ipoe: nl_create: error talking to kernel\n"); + if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) { + log_ppp_error("ipoe: nl_create: %s\n", strerror(errno)); + goto out; + } if (nlh->nlmsg_type != ipoe_genl_id) { log_ppp_error("ipoe: not a IPoE message %d\n", nlh->nlmsg_type); @@ -337,7 +339,7 @@ int ipoe_nl_modify(int ifindex, uint32_t peer_addr, uint32_t addr, uint32_t gw, addattr_l(nlh, 1024, IPOE_ATTR_HWADDR, hwaddr, 6); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) { - log_ppp_error("ipoe: nl_create: error talking to kernel\n"); + log_ppp_error("ipoe: nl_modify: %s\n", strerror(errno)); ret = -1; } @@ -451,7 +453,7 @@ void ipoe_nl_delete(int ifindex) addattr32(nlh, 128, IPOE_ATTR_IFINDEX, ifindex); if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL, 0) < 0 ) - log_ppp_error("ipoe: nl_delete: error talking to kernel\n"); + log_ppp_error("ipoe: nl_delete: %s\n", strerror(errno)); rtnl_close(&rth); } |