diff options
Diffstat (limited to 'sys/netlink/route')
| -rw-r--r-- | sys/netlink/route/iface.c | 11 | ||||
| -rw-r--r-- | sys/netlink/route/neigh.c | 5 | ||||
| -rw-r--r-- | sys/netlink/route/nexthop.c | 11 | ||||
| -rw-r--r-- | sys/netlink/route/rt.c | 9 |
4 files changed, 20 insertions, 16 deletions
diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index e6a3d7d00a8f..c19161f5bbb7 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -1363,7 +1363,7 @@ static void rtnl_handle_ifaddr(void *arg __unused, struct ifaddr *ifa, int cmd) { struct nlmsghdr hdr = {}; - struct nl_writer nw = {}; + struct nl_writer nw; uint32_t group = 0; switch (ifa->ifa_addr->sa_family) { @@ -1386,7 +1386,7 @@ rtnl_handle_ifaddr(void *arg __unused, struct ifaddr *ifa, int cmd) if (!nl_has_listeners(NETLINK_ROUTE, group)) return; - if (!nlmsg_get_group_writer(&nw, NLMSG_LARGE, NETLINK_ROUTE, group)) { + if (!nl_writer_group(&nw, NLMSG_LARGE, NETLINK_ROUTE, group, false)) { NL_LOG(LOG_DEBUG, "error allocating group writer"); return; } @@ -1401,13 +1401,14 @@ static void rtnl_handle_ifevent(if_t ifp, int nlmsg_type, int if_flags_mask) { struct nlmsghdr hdr = { .nlmsg_type = nlmsg_type }; - struct nl_writer nw = {}; + struct nl_writer nw; if (!nl_has_listeners(NETLINK_ROUTE, RTNLGRP_LINK)) return; - if (!nlmsg_get_group_writer(&nw, NLMSG_LARGE, NETLINK_ROUTE, RTNLGRP_LINK)) { - NL_LOG(LOG_DEBUG, "error allocating mbuf"); + if (!nl_writer_group(&nw, NLMSG_LARGE, NETLINK_ROUTE, RTNLGRP_LINK, + false)) { + NL_LOG(LOG_DEBUG, "error allocating group writer"); return; } dump_iface(&nw, ifp, &hdr, if_flags_mask); diff --git a/sys/netlink/route/neigh.c b/sys/netlink/route/neigh.c index 5be0c1f9d91f..c5003eddaba1 100644 --- a/sys/netlink/route/neigh.c +++ b/sys/netlink/route/neigh.c @@ -552,6 +552,7 @@ static const struct rtnl_cmd_handler cmd_handlers[] = { static void rtnl_lle_event(void *arg __unused, struct llentry *lle, int evt) { + struct nl_writer nw; if_t ifp; int family; @@ -565,8 +566,8 @@ rtnl_lle_event(void *arg __unused, struct llentry *lle, int evt) int nlmsgs_type = evt == LLENTRY_RESOLVED ? NL_RTM_NEWNEIGH : NL_RTM_DELNEIGH; - struct nl_writer nw = {}; - if (!nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, RTNLGRP_NEIGH)) { + if (!nl_writer_group(&nw, NLMSG_SMALL, NETLINK_ROUTE, RTNLGRP_NEIGH, + false)) { NL_LOG(LOG_DEBUG, "error allocating group writer"); return; } diff --git a/sys/netlink/route/nexthop.c b/sys/netlink/route/nexthop.c index 0d6bb5c9ec84..90ed3497047e 100644 --- a/sys/netlink/route/nexthop.c +++ b/sys/netlink/route/nexthop.c @@ -506,7 +506,7 @@ static int delete_unhop(struct unhop_ctl *ctl, struct nlmsghdr *hdr, uint32_t uidx) { struct user_nhop *unhop_ret, *unhop_base, *unhop_chain; - + struct nl_writer nw; struct user_nhop key = { .un_idx = uidx }; UN_WLOCK(ctl); @@ -553,8 +553,8 @@ delete_unhop(struct unhop_ctl *ctl, struct nlmsghdr *hdr, uint32_t uidx) .hdr.nlmsg_type = NL_RTM_DELNEXTHOP, }; - struct nl_writer nw = {}; - if (!nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, RTNLGRP_NEXTHOP)) { + if (!nl_writer_group(&nw, NLMSG_SMALL, NETLINK_ROUTE, RTNLGRP_NEXTHOP, + false)) { NL_LOG(LOG_DEBUG, "error allocating message writer"); return (ENOMEM); } @@ -881,6 +881,7 @@ static int rtnl_handle_newnhop(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt) { + struct nl_writer nw; struct user_nhop *unhop; int error; @@ -947,8 +948,8 @@ rtnl_handle_newnhop(struct nlmsghdr *hdr, struct nlpcb *nlp, .hdr.nlmsg_type = NL_RTM_NEWNEXTHOP, }; - struct nl_writer nw = {}; - if (!nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, RTNLGRP_NEXTHOP)) { + if (!nl_writer_group(&nw, NLMSG_SMALL, NETLINK_ROUTE, RTNLGRP_NEXTHOP, + false)) { NL_LOG(LOG_DEBUG, "error allocating message writer"); return (ENOMEM); } diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c index 00315afbcb02..c9b0f56498ec 100644 --- a/sys/netlink/route/rt.c +++ b/sys/netlink/route/rt.c @@ -350,10 +350,10 @@ static void report_operation(uint32_t fibnum, struct rib_cmd_info *rc, struct nlpcb *nlp, struct nlmsghdr *hdr) { - struct nl_writer nw = {}; + struct nl_writer nw; uint32_t group_id = family_to_group(rt_get_family(rc->rc_rt)); - if (nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id)) { + if (nl_writer_group(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id, false)) { struct route_nhop_data rnd = { .rnd_nhop = rc_get_nhop(rc), .rnd_weight = rc->rc_nh_weight, @@ -1043,7 +1043,7 @@ rtnl_handle_getroute(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate * void rtnl_handle_route_event(uint32_t fibnum, const struct rib_cmd_info *rc) { - struct nl_writer nw = {}; + struct nl_writer nw; int family, nlm_flags = 0; family = rt_get_family(rc->rc_rt); @@ -1082,7 +1082,8 @@ rtnl_handle_route_event(uint32_t fibnum, const struct rib_cmd_info *rc) }; uint32_t group_id = family_to_group(family); - if (!nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id)) { + if (!nl_writer_group(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id, + false)) { NL_LOG(LOG_DEBUG, "error allocating event buffer"); return; } |
