#include "bpf.h"
 #include "libbpf.h"
+#include "libbpf_internal.h"
 #include "nlattr.h"
 
 #ifndef SOL_NETLINK
 
        if (setsockopt(sock, SOL_NETLINK, NETLINK_EXT_ACK,
                       &one, sizeof(one)) < 0) {
-               fprintf(stderr, "Netlink error reporting not supported\n");
+               pr_warn("Netlink error reporting not supported\n");
        }
 
        if (bind(sock, (struct sockaddr *)&sa, sizeof(sa)) < 0) {
 
 
 #include <errno.h>
 #include "nlattr.h"
+#include "libbpf_internal.h"
 #include <linux/rtnetlink.h>
 #include <string.h>
 #include <stdio.h>
                }
 
                if (tb[type])
-                       fprintf(stderr, "Attribute of type %#x found multiple times in message, "
-                                 "previous attribute is being ignored.\n", type);
+                       pr_warn("Attribute of type %#x found multiple times in message, "
+                               "previous attribute is being ignored.\n", type);
 
                tb[type] = nla;
        }
 
        if (libbpf_nla_parse(tb, NLMSGERR_ATTR_MAX, attr, alen,
                             extack_policy) != 0) {
-               fprintf(stderr,
-                       "Failed to parse extended error attributes\n");
+               pr_warn("Failed to parse extended error attributes\n");
                return 0;
        }
 
        if (tb[NLMSGERR_ATTR_MSG])
                errmsg = (char *) libbpf_nla_data(tb[NLMSGERR_ATTR_MSG]);
 
-       fprintf(stderr, "Kernel error message: %s\n", errmsg);
+       pr_warn("Kernel error message: %s\n", errmsg);
 
        return 0;
 }