From be1d17967961af52936d177bb5e426bc2a6b6ef0 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Mon, 9 Oct 2017 16:45:09 +0300 Subject: ipoe: more verbose netlink errors --- accel-pppd/ctrl/ipoe/ipoe_netlink.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'accel-pppd/ctrl/ipoe') 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); } -- cgit v1.2.3