summaryrefslogtreecommitdiffhomepage
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-06-03 14:16:52 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-06-03 14:16:52 +0200
commit45e3967c20b5020bf720b9497592e231104398f3 (patch)
tree364a53e80d1c2246e33fb00c4f6bb26e854912ae /networking
parent498cec202adbf69a7a72af5e204260682d614183 (diff)
libbb: move netlink socket binding to the utility function
function old new delta create_and_bind_to_netlink - 134 +134 ifplugd_main 1117 1052 -65 uevent_main 399 306 -93 mdev_main 314 215 -99 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 134/-257) Total: -123 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/ifplugd.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 1426709cb..b7b26c113 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -604,15 +604,7 @@ int ifplugd_main(int argc UNUSED_PARAM, char **argv)
xmove_fd(xsocket(AF_INET, SOCK_DGRAM, 0), ioctl_fd);
if (opts & FLAG_MONITOR) {
- struct sockaddr_nl addr;
- int fd = xsocket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
-
- memset(&addr, 0, sizeof(addr));
- addr.nl_family = AF_NETLINK;
- addr.nl_groups = RTMGRP_LINK;
- addr.nl_pid = getpid();
-
- xbind(fd, (struct sockaddr*)&addr, sizeof(addr));
+ int fd = create_and_bind_to_netlink(NETLINK_ROUTE, RTMGRP_LINK, 0);
xmove_fd(fd, netlink_fd);
}