Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145011199
D55174.id171819.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55174.id171819.diff
View Options
diff --git a/sbin/ifconfig/ifconfig_netlink.h b/sbin/ifconfig/ifconfig_netlink.h
--- a/sbin/ifconfig/ifconfig_netlink.h
+++ b/sbin/ifconfig/ifconfig_netlink.h
@@ -34,4 +34,7 @@
#include <netlink/netlink_snl_route.h>
#include <netlink/netlink_snl_route_compat.h>
#include <netlink/netlink_snl_route_parsers.h>
+
+
+void ifcreate_nl(if_ctx *, struct nlmsghdr *);
#endif
diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -457,7 +457,7 @@
nl_init_socket(&ss);
- struct ifmap *ifmap = prepare_ifmap(&ss, args->ifname);
+ struct ifmap *ifmap = prepare_ifmap(&ss, args->ifname);
struct iface **sorted_ifaces = snl_allocz(&ss, ifmap->count * sizeof(void *));
for (uint32_t i = 0, num = 0; i < ifmap->size; i++) {
if (ifmap->ifaces[i] != NULL) {
@@ -493,3 +493,20 @@
snl_free(&ss);
}
+void
+ifcreate_nl(if_ctx *ctx, struct nlmsghdr *hdr)
+{
+ struct snl_state *ss = ctx->io_ss;
+ struct snl_errmsg_data errmsg = {};
+
+ if (!snl_send_message(ss, hdr))
+ err(1, "unable to send netlink message");
+
+ hdr = snl_read_reply(ss, hdr->nlmsg_seq);
+ if (hdr->nlmsg_type != NL_RTM_NEWLINK) {
+ if (!snl_parse_errmsg(ss, hdr, &errmsg))
+ errx(EINVAL, "unknown error from netlink(4)");
+ if (errmsg.error_str != NULL)
+ errx(errmsg.error, "%s", errmsg.error_str);
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 16, 12:51 AM (16 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28677440
Default Alt Text
D55174.id171819.diff (1 KB)
Attached To
Mode
D55174: ifconfig: Add netlink helper to create interface
Attached
Detach File
Event Timeline
Log In to Comment