/freebsd/sys/netlink/ |
H A D | netlink_message_writer.c | 60 nw->hdr = NULL; in nlmsg_get_buf() 72 return (nl_send(nw, nw->nlp)); in nl_send_one() 78 nw->nlp = nlp; in _nlmsg_get_unicast_writer() 107 int completed_len = (char *)nw->hdr - nw->buf->data; in _nlmsg_flush() 109 nw->buf->datalen -= nw->buf->datalen - completed_len; in _nlmsg_flush() 120 result = nw->cb(nw); in _nlmsg_flush() 151 (char *)nw->hdr - nw->buf->data : nw->buf->datalen; in _nlmsg_refill_buffer() 241 nw->hdr->nlmsg_len, nw->hdr->nlmsg_type, nw->hdr->nlmsg_flags, in _nlmsg_end() 242 nw->hdr->nlmsg_seq, nw->hdr->nlmsg_pid); in _nlmsg_end() 266 struct nl_writer *nw = npt->nw; in nlmsg_ack() local [all …]
|
H A D | netlink_message_writer.h | 71 bool _nlmsg_flush(struct nl_writer *nw); 77 bool _nlmsg_end(struct nl_writer *nw); 96 nlmsg_flush(struct nl_writer *nw) in nlmsg_flush() argument 98 return (_nlmsg_flush(nw)); in nlmsg_flush() 104 _nlmsg_ignore_limit(nw); in nlmsg_ignore_limit() 121 nlmsg_end(struct nl_writer *nw) in nlmsg_end() argument 123 return (_nlmsg_end(nw)); in nlmsg_end() 127 nlmsg_abort(struct nl_writer *nw) in nlmsg_abort() argument 129 return (_nlmsg_abort(nw)); in nlmsg_abort() 150 bool nlmsg_end(struct nl_writer *nw); [all …]
|
H A D | netlink_glue.c | 115 bzero(nw, sizeof(*nw)); in get_stub_writer() 116 nw->enomem = true; in get_stub_writer() 124 return (get_stub_writer(nw)); in nlmsg_get_unicast_writer_stub() 130 return (get_stub_writer(nw)); in nlmsg_get_group_writer_stub() 136 return (get_stub_writer(nw)); in nlmsg_get_chain_writer_stub() 247 nlmsg_flush(struct nl_writer *nw) in nlmsg_flush() argument 249 return (_nl->nlmsg_flush(nw)); in nlmsg_flush() 254 _nl->nlmsg_ignore_limit(nw); in nlmsg_ignore_limit() 271 nlmsg_end(struct nl_writer *nw) in nlmsg_end() argument 273 return (_nl->nlmsg_end(nw)); in nlmsg_end() [all …]
|
H A D | netlink_snl.h | 1050 nw->base = (char *)snl_allocz(ss, nw->size); in snl_init_writer() 1053 nw->size = 0; in snl_init_writer() 1059 nw->ss = ss; in snl_init_writer() 1081 memcpy(new_base, nw->base, nw->offset); in snl_realloc_msg_buffer() 1083 int hdr_off = (char *)(nw->hdr) - nw->base; in snl_realloc_msg_buffer() 1099 if (__predict_false(nw->offset + sz > nw->size)) { in snl_reserve_msg_data_raw() 1104 void *data_ptr = &nw->base[nw->offset]; in snl_reserve_msg_data_raw() 1232 return (nw->offset - ((char *)nw->hdr - nw->base)); in snl_get_msg_offset() 1279 int offset = (char *)(&nw->base[nw->offset]) - (char *)(nw->hdr); in snl_abort_msg() 1294 int offset = (char *)(&nw->base[nw->offset]) - (char *)(nw->hdr); in snl_finalize_msg() [all …]
|
H A D | netlink_generic.c | 134 int cmd_off = nlattr_add_nested(nw, ++cnt); in dump_family() 140 nlattr_set_len(nw, cmd_off); in dump_family() 142 nlattr_set_len(nw, off); in dump_family() 158 nlattr_set_len(nw, cmd_off); in dump_family() 160 nlattr_set_len(nw, off); in dump_family() 162 if (nlmsg_end(nw)) in dump_family() 166 nlmsg_abort(nw); in dump_family() 246 if (!nlmsg_end_dump(npt->nw, error, hdr)) { in nlctrl_handle_getfamily() 259 struct nl_writer nw = {}; in nlctrl_notify() local 262 dump_family(&hdr, &ghdr, gf, &nw); in nlctrl_notify() [all …]
|
H A D | netlink_io.c | 203 MPASS(nw->hdr == NULL); in nl_send() 204 MPASS(nw->buf != NULL); in nl_send() 211 nw->buf->datalen, nw->num_messages, hdr->nlmsg_type, in nl_send() 217 nl_buf_free(nw->buf); in nl_send() 218 nw->buf = NULL; in nl_send() 222 nb = nw->buf; in nl_send() 223 nw->buf = NULL; in nl_send() 325 struct nl_writer nw = {}; in nl_process_nbuf() local 331 nlmsg_ignore_limit(&nw); in nl_process_nbuf() 337 .nw = &nw, in nl_process_nbuf() [all …]
|
H A D | netlink_snl_generic.h | 36 snl_create_genl_msg_request(struct snl_writer *nw, int genl_family, uint8_t genl_cmd) in snl_create_genl_msg_request() argument 38 assert(nw->hdr == NULL); in snl_create_genl_msg_request() 40 struct nlmsghdr *hdr = snl_reserve_msg_object(nw, struct nlmsghdr); in snl_create_genl_msg_request() 43 nw->hdr = hdr; in snl_create_genl_msg_request() 44 struct genlmsghdr *ghdr = snl_reserve_msg_object(nw, struct genlmsghdr); in snl_create_genl_msg_request() 101 struct snl_writer nw; in snl_get_genl_family_info() local 106 snl_init_writer(ss, &nw); in snl_get_genl_family_info() 107 hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); in snl_get_genl_family_info() 108 snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, family_name); in snl_get_genl_family_info() 109 if ((hdr = snl_finalize_msg(&nw)) == NULL || !snl_send_message(ss, hdr)) in snl_get_genl_family_info()
|
H A D | netlink_sysevent.c | 83 struct nl_writer nw = {}; in sysevent_write() local 85 if (!nlmsg_get_group_writer(&nw, NLMSG_LARGE, NETLINK_GENERIC, se->id)) { in sysevent_write() 90 if (!nlmsg_reply(&nw, &hdr, sizeof(struct genlmsghdr))) { in sysevent_write() 94 struct genlmsghdr *ghdr = nlmsg_reserve_object(&nw, struct genlmsghdr); in sysevent_write() 102 nlattr_add_string(&nw, NLSE_ATTR_SYSTEM, se->name); in sysevent_write() 103 nlattr_add_string(&nw, NLSE_ATTR_SUBSYSTEM, subsystem); in sysevent_write() 104 nlattr_add_string(&nw, NLSE_ATTR_TYPE, type); in sysevent_write() 106 nlattr_add_string(&nw, NLSE_ATTR_DATA, data); in sysevent_write() 107 nlmsg_end(&nw); in sysevent_write() 108 nlmsg_flush(&nw); in sysevent_write()
|
H A D | netlink_snl_route.h | 131 snl_add_msg_attr_ip4(struct snl_writer *nw, int attrtype, const struct in_addr *addr) in snl_add_msg_attr_ip4() argument 133 return (snl_add_msg_attr(nw, attrtype, 4, addr)); in snl_add_msg_attr_ip4() 137 snl_add_msg_attr_ip6(struct snl_writer *nw, int attrtype, const struct in6_addr *addr) in snl_add_msg_attr_ip6() argument 139 return (snl_add_msg_attr(nw, attrtype, 16, addr)); in snl_add_msg_attr_ip6() 143 snl_add_msg_attr_ip(struct snl_writer *nw, int attrtype, const struct sockaddr *sa) in snl_add_msg_attr_ip() argument 150 return (snl_add_msg_attr(nw, attrtype, 4, addr)); in snl_add_msg_attr_ip() 153 return (snl_add_msg_attr(nw, attrtype, 16, addr)); in snl_add_msg_attr_ip() 160 snl_add_msg_attr_ipvia(struct snl_writer *nw, int attrtype, const struct sockaddr *sa) in snl_add_msg_attr_ipvia() argument 169 return (snl_add_msg_attr(nw, attrtype, 5, buf)); in snl_add_msg_attr_ipvia() 172 return (snl_add_msg_attr(nw, attrtype, 17, buf)); in snl_add_msg_attr_ipvia()
|
H A D | netlink_var.h | 179 bool (*nlmsg_add)(struct nl_writer *nw, uint32_t portid, uint32_t seq, uint16_t type, 181 bool (*nlmsg_refill_buffer)(struct nl_writer *nw, int required_len); 182 bool (*nlmsg_flush)(struct nl_writer *nw); 183 bool (*nlmsg_end)(struct nl_writer *nw); 184 void (*nlmsg_abort)(struct nl_writer *nw); 185 void (*nlmsg_ignore_limit)(struct nl_writer *nw); 186 bool (*nlmsg_get_unicast_writer)(struct nl_writer *nw, int size, struct nlpcb *nlp); 187 bool (*nlmsg_get_group_writer)(struct nl_writer *nw, int size, int protocol, int group_id); 188 bool (*nlmsg_get_chain_writer)(struct nl_writer *nw, int size, struct mbuf **pm); 189 bool (*nlmsg_end_dump)(struct nl_writer *nw, int error, struct nlmsghdr *hdr);
|
/freebsd/sys/compat/linux/ |
H A D | linux_netlink.c | 209 nw->num_messages++; in handle_default_out() 383 nlmsg_end(nw); in rtnl_newlink_to_linux() 405 nlmsg_end(nw); in rtnl_newaddr_to_linux() 426 nlmsg_end(nw); in rtnl_newneigh_to_linux() 474 nlmsg_end(nw); in rtnl_newroute_to_linux() 518 nlmsg_end(nw); in nlmsg_error_to_linux() 535 nlmsg_end(nw); in nlmsg_error_to_linux() 573 nw->buf->datalen, nw->num_messages); in nlmsgs_to_linux() 575 orig = nw->buf; in nlmsgs_to_linux() 579 nw->buf = nb; in nlmsgs_to_linux() [all …]
|
/freebsd/sys/netpfil/pf/ |
H A D | pf_nl.c | 146 struct nl_writer *nw = npt->nw; in dump_state() local 215 if (nlmsg_end(nw)) in dump_state() 220 nlmsg_abort(nw); in dump_state() 295 struct nl_writer *nw = npt->nw; in dump_creatorid() local 311 nlmsg_abort(nw); in dump_creatorid() 797 struct nl_writer *nw = npt->nw; in pf_handle_getrules() local 827 nlmsg_abort(nw); in pf_handle_getrules() 858 struct nl_writer *nw = npt->nw; in pf_handle_getrule() local 1035 struct nl_writer *nw = npt->nw; in pf_handle_killclear_states() local 1162 struct nl_writer *nw = npt->nw; in pf_handle_get_status() local [all …]
|
/freebsd/usr.sbin/arp/ |
H A D | arp_netlink.c | 58 struct snl_writer nw; in get_link_info() local 60 snl_init_writer(ss, &nw); in get_link_info() 107 struct snl_writer nw; in guess_ifindex() local 109 snl_init_writer(ss, &nw); in guess_ifindex() 141 snl_init_writer(ss, &nw); in guess_ifindex() 149 snl_end_attr_nested(&nw, off); in guess_ifindex() 275 struct snl_writer nw; in print_entries_nl() local 333 struct snl_writer nw; in delete_nl() local 349 snl_init_writer(&ss, &nw); in delete_nl() 382 struct snl_writer nw; in set_nl() local [all …]
|
/freebsd/usr.sbin/ndp/ |
H A D | ndp_netlink.c | 71 struct snl_writer nw; in get_link_info() local 73 snl_init_writer(ss, &nw); in get_link_info() 138 struct snl_writer nw; in guess_ifindex() local 146 snl_init_writer(ss, &nw); in guess_ifindex() 177 snl_init_writer(ss, &nw); in guess_ifindex() 185 snl_end_attr_nested(&nw, off); in guess_ifindex() 318 struct snl_writer nw; in print_entries_nl() local 399 struct snl_writer nw; in delete_nl() local 417 snl_init_writer(&ss, &nw); in delete_nl() 470 struct snl_writer nw; in set_nl() local [all …]
|
/freebsd/tests/sys/netlink/ |
H A D | test_snl.c | 56 struct snl_writer nw; in ATF_TC_BODY() local 68 snl_init_writer(&ss, &nw); in ATF_TC_BODY() 74 ATF_CHECK(snl_finalize_msg(&nw) != NULL); in ATF_TC_BODY() 98 struct snl_writer nw; in ATF_TC_BODY() local 110 snl_init_writer(&ss, &nw); in ATF_TC_BODY() 116 ATF_CHECK(snl_finalize_msg(&nw) != NULL); in ATF_TC_BODY() 141 struct snl_writer nw; in ATF_TC_BODY() local 150 snl_init_writer(&ss, &nw); in ATF_TC_BODY() 156 ATF_CHECK(snl_finalize_msg(&nw) != NULL); in ATF_TC_BODY() 201 struct snl_writer nw; in ATF_TC_BODY() local [all …]
|
/freebsd/lib/libifconfig/ |
H A D | libifconfig_carp.c | 73 struct snl_writer nw; in _ifconfig_carp_get() local 88 snl_init_writer(&ss, &nw); in _ifconfig_carp_get() 99 snl_add_msg_attr_string(&nw, CARP_NL_IFNAME, name); in _ifconfig_carp_get() 102 snl_add_msg_attr_u32(&nw, CARP_NL_VHID, vhid); in _ifconfig_carp_get() 104 hdr = snl_finalize_msg(&nw); in _ifconfig_carp_get() 150 struct snl_writer nw; in ifconfig_carp_set_info() local 162 snl_init_writer(&ss, &nw); in ifconfig_carp_set_info() 171 snl_add_msg_attr_u32(&nw, CARP_NL_VHID, carpr->carpr_vhid); in ifconfig_carp_set_info() 175 snl_add_msg_attr_string(&nw, CARP_NL_IFNAME, name); in ifconfig_carp_set_info() 180 snl_add_msg_attr_string(&nw, CARP_NL_KEY, carpr->carpr_key); in ifconfig_carp_set_info() [all …]
|
/freebsd/lib/libpfctl/ |
H A D | libpfctl.c | 115 struct snl_writer nw; in pfctl_do_netlink_cmd() local 405 struct snl_writer nw; in pfctl_get_status_h() local 1302 struct snl_writer nw; in pfctl_add_rule_h() local 1354 struct snl_writer nw; in pfctl_get_rules_info_h() local 1659 struct snl_writer nw; in pfctl_get_clear_rule_h() local 1774 struct snl_writer nw; in pfctl_get_creators_nl() local 1914 struct snl_writer nw; in pfctl_get_states_nl() local 2035 struct snl_writer nw; in _pfctl_clear_states_h() local 2410 struct snl_writer nw; in pfctl_set_statusif() local 2456 struct snl_writer nw; in pfctl_natlook() local [all …]
|
/freebsd/sbin/pflowctl/ |
H A D | pflowctl.c | 99 struct snl_writer nw; in list() local 109 snl_init_writer(&ss, &nw); in list() 112 hdr = snl_finalize_msg(&nw); in list() 151 struct snl_writer nw; in create() local 161 snl_init_writer(&ss, &nw); in create() 189 struct snl_writer nw; in del() local 203 snl_init_writer(&ss, &nw); in del() 322 struct snl_writer nw; in get() local 332 snl_init_writer(&ss, &nw); in get() 403 struct snl_writer nw; in do_set() local [all …]
|
/freebsd/sys/tests/ |
H A D | ktest.c | 99 struct nl_writer *nw = npt->nw; in dump_mod_test() local 101 if (!create_reply(nw, hdr, KTEST_CMD_NEWTEST)) in dump_mod_test() 108 if (nlmsg_end(nw)) in dump_mod_test() 111 nlmsg_abort(nw); in dump_mod_test() 154 if (!nlmsg_end_dump(npt->nw, error, hdr)) { in dump_tests() 236 if (!nlmsg_end_dump(npt->nw, error, hdr)) { in run_test() 312 struct nl_writer *nw = ctx->npt->nw; in ktest_add_msg_meta() local 318 nlattr_add_string(nw, KTEST_MSG_ATTR_FUNC, func); in ktest_add_msg_meta() 319 nlattr_add_string(nw, KTEST_MSG_ATTR_FILE, fname); in ktest_add_msg_meta() 320 nlattr_add_u32(nw, KTEST_MSG_ATTR_LINE, line); in ktest_add_msg_meta() [all …]
|
/freebsd/sys/netlink/route/ |
H A D | iface.c | 62 struct nl_writer *nw; member 275 nlattr_set_len(nw, off); in dump_iface_caps() 351 get_hwaddr(nw, ifp); in dump_iface() 354 nlattr_set_len(nw, off); in dump_iface() 357 get_stats(nw, ifp); in dump_iface() 369 nlmsg_abort(nw); in dump_iface() 463 .nw = npt->nw, in rtnl_handle_getlink() 1022 if (nlmsg_end(nw)) in dump_iface_addr() 1027 nlmsg_abort(nw); in dump_iface_addr() 1070 .nw = npt->nw, in rtnl_handle_getaddr() [all …]
|
H A D | rt.c | 216 nlattr_set_len(nw, off); in dump_rc_nhg() 241 dump_rc_nhop_gw(nw, nh); in dump_rc_nhop() 250 dump_rc_nhop_mtu(nw, nh); in dump_rc_nhop() 269 struct nl_writer *nw) in dump_px() argument 328 if (nlmsg_end(nw)) in dump_px() 333 nlmsg_abort(nw); in dump_px() 353 struct nl_writer nw = {}; in report_operation() local 377 nlmsg_flush(&nw); in report_operation() 527 struct nl_writer *nw; member 666 .nw = nw, in handle_rtm_dump() [all …]
|
H A D | neigh.c | 61 struct nl_writer *nw; member 138 struct nl_writer *nw = wa->nw; in dump_lle_locked() local 166 nlattr_add(nw, NDA_DST, 4, &addr); in dump_lle_locked() 173 nlattr_add(nw, NDA_DST, 16, &addr); in dump_lle_locked() 197 nlattr_set_len(nw, off); in dump_lle_locked() 200 if (nlmsg_end(nw)) in dump_lle_locked() 204 nlmsg_abort(nw); in dump_lle_locked() 517 .nw = npt->nw, in rtnl_handle_getneigh() 568 struct nl_writer nw = {}; in rtnl_lle_event() local 576 .nw = &nw, in rtnl_lle_event() [all …]
|
H A D | nexthop.c | 382 struct nl_writer *nw; member 394 struct nl_writer *nw) in dump_nhgrp() argument 427 if (nlmsg_end(nw)) in dump_nhgrp() 431 nlmsg_abort(nw); in dump_nhgrp() 437 struct nl_writer *nw) in dump_nhop() argument 484 nlattr_set_len(nw, off); in dump_nhop() 491 nlmsg_abort(nw); in dump_nhop() 497 struct nl_writer *nw) in dump_unhop() argument 563 nlmsg_flush(&nw); in delete_unhop() 957 nlmsg_flush(&nw); in rtnl_handle_newnhop() [all …]
|
/freebsd/crypto/openssl/crypto/bn/ |
H A D | bn_shift.c | 106 int i, nw; in bn_lshift_fixed_top() local 116 nw = n / BN_BITS2; in bn_lshift_fixed_top() 127 t = &(r->d[nw]); in bn_lshift_fixed_top() 138 r->d[nw] = 0; in bn_lshift_fixed_top() 140 if (nw != 0) in bn_lshift_fixed_top() 144 r->top = a->top + nw + 1; in bn_lshift_fixed_top() 175 int i, top, nw; in bn_rshift_fixed_top() local 185 nw = n / BN_BITS2; in bn_rshift_fixed_top() 186 if (nw >= a->top) { in bn_rshift_fixed_top() 197 top = a->top - nw; in bn_rshift_fixed_top() [all …]
|
/freebsd/sbin/route/ |
H A D | route_netlink.c | 146 struct snl_writer nw; in rtmsg_nl_int() local 149 snl_init_writer(ss, &nw); in rtmsg_nl_int() 223 snl_add_msg_attr_ip(&nw, RTA_DST, dst); in rtmsg_nl_int() 224 snl_add_msg_attr_u32(&nw, RTA_TABLE, fib); in rtmsg_nl_int() 263 snl_end_attr_nested(&nw, off); in rtmsg_nl_int() 315 struct snl_writer nw; in get_ifdata() local 317 snl_init_writer(ss, &nw); in get_ifdata() 813 struct snl_writer nw; in flushroute_one() local 815 snl_init_writer(ss, &nw); in flushroute_one() 860 struct snl_writer nw; in flushroutes_fib_nl() local [all …]
|