On embedded systems, there is no guarantee that INET support has been
built in.  However, as long as network support is built into the kernel,
we can use the netlink protocol to create a socket to still then use for
the ioctl calls since they don't require any certain family.  This will
help prevent EAFNOSUPPORT from being returned and printed to the console
on these systems.

Signed-off-by: Mason Rocha <[email protected]>
---
 kexec/ifdown.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/ifdown.c b/kexec/ifdown.c
index 3ac19c1..6a60bcb 100644
--- a/kexec/ifdown.c
+++ b/kexec/ifdown.c
@@ -31,7 +31,7 @@ int ifdown(void)
        struct ifreq ifr;
        int fd, shaper;
 
-       if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+       if ((fd = socket(AF_NETLINK, SOCK_DGRAM, 0)) < 0) {
                fprintf(stderr, "ifdown: ");
                perror("socket");
                goto error;
-- 
2.51.0


Reply via email to