Lines Matching defs:nw

124 dump_rc_nhop_gw(struct nl_writer *nw, const struct nhop_object *nh)
135 nlattr_add(nw, NL_RTA_GATEWAY, 4, &nh->gw4_sa.sin_addr);
144 nlattr_add(nw, NL_RTA_GATEWAY, 16, &gw6);
154 nlattr_add(nw, NL_RTA_VIA, 17, via);
162 dump_rc_nhop_mtu(struct nl_writer *nw, const struct nhop_object *nh)
165 struct nlattr *nla = nlmsg_reserve_data(nw, nla_len, struct nlattr);
179 dump_rc_nhg(struct nl_writer *nw, const struct nhgrp_object *nhg, struct rtmsg *rtm)
187 nlattr_add_u32(nw, NL_RTA_NH_ID, uidx);
188 nlattr_add_u32(nw, NL_RTA_KNH_ID, nhgrp_get_idx(nhg));
190 nlattr_add_u32(nw, NL_RTA_RTFLAGS, base_rtflags);
191 int off = nlattr_add_nested(nw, NL_RTA_MULTIPATH);
196 int nh_off = nlattr_save_offset(nw);
197 struct rtnexthop *rtnh = nlmsg_reserve_object(nw, struct rtnexthop);
203 dump_rc_nhop_gw(nw, wn[i].nh);
206 nlattr_add_u32(nw, NL_RTA_RTFLAGS, rtflags);
208 dump_rc_nhop_mtu(nw, wn[i].nh);
209 rtnh = nlattr_restore_offset(nw, nh_off, struct rtnexthop);
214 rtnh->rtnh_len = nlattr_save_offset(nw) - nh_off;
216 nlattr_set_len(nw, off);
221 dump_rc_nhop(struct nl_writer *nw, const struct route_nhop_data *rnd, struct rtmsg *rtm)
225 dump_rc_nhg(nw, rnd->rnd_nhgrp, rtm);
241 dump_rc_nhop_gw(nw, nh);
245 nlattr_add_u32(nw, NL_RTA_NH_ID, uidx);
246 nlattr_add_u32(nw, NL_RTA_KNH_ID, nhop_get_idx(nh));
247 nlattr_add_u32(nw, NL_RTA_RTFLAGS, rtflags);
250 dump_rc_nhop_mtu(nw, nh);
253 nlattr_add_u32(nw, NL_RTA_EXPIRES, nh_expire - time_uptime);
256 nlattr_add_u32(nw, NL_RTA_OIF, if_getindex(nh->nh_ifp));
259 nlattr_add_u32(nw, NL_RTA_WEIGHT, rnd->rnd_weight);
269 struct nl_writer *nw)
276 if (!nlmsg_reply(nw, hdr, sizeof(struct rtmsg)))
280 int rtm_off = nlattr_save_offset(nw);
281 rtm = nlmsg_reserve_object(nw, struct rtmsg);
292 nlattr_add_u32(nw, NL_RTA_TABLE, fibnum);
304 nlattr_add(nw, NL_RTA_DST, 4, &addr);
313 nlattr_add(nw, NL_RTA_DST, 16, &addr);
323 rtm = nlattr_restore_offset(nw, rtm_off, struct rtmsg);
326 dump_rc_nhop(nw, rnd, rtm);
328 if (nlmsg_end(nw))
333 nlmsg_abort(nw);
353 struct nl_writer nw = {};
356 if (nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id)) {
376 dump_px(fibnum, hdr, rc->rc_rt, &rnd, &nw);
377 nlmsg_flush(&nw);
529 struct nl_writer *nw;
556 error = dump_px(wa->fibnum, &wa->hdr, rt, &wa->rnd, wa->nw);
657 dump_px(fibnum, hdr, rt, &rnd, npt->nw);
664 struct nlmsghdr *hdr, struct nl_writer *nw)
668 .nw = nw,
690 if (!nlmsg_end_dump(wa.nw, wa.error, &wa.hdr)) {
1036 error = handle_rtm_dump(nlp, attrs.rta_table, attrs.rtm_family, hdr, npt->nw);
1046 struct nl_writer nw = {};
1085 if (!nlmsg_get_group_writer(&nw, NLMSG_SMALL, NETLINK_ROUTE, group_id)) {
1090 dump_px(fibnum, &hdr, rc->rc_rt, &rnd, &nw);
1091 nlmsg_flush(&nw);