Esempio n. 1
0
font_face::~font_face()
{
    MAPNIK_LOG_DEBUG(font_face) <<
        "font_face: Clean up face \"" << family_name() <<
        " " << style_name() << "\"";

    FT_Done_Face(face_);
}
Esempio n. 2
0
int get_addr(inet_prefix *dst, const char *arg, int family)
{
	if (get_addr_1(dst, arg, family)) {
		fprintf(stderr, "Error: %s address is expected rather than \"%s\".\n",
				family_name(family) ,arg);
		exit(1);
	}
	return 0;
}
Esempio n. 3
0
/*
 * perform the socket system call. we locate the appropriate family, then
 * create a fresh socket.
 */
static int
sock_socket(int family, int type, int protocol)
{
	int i, fd;
	struct socket *sock;
	struct proto_ops *ops;

	PRINTK("sys_socket: family = %d (%s), type = %d, protocol = %d\n",
	       family, family_name(family), type, protocol);

	/*
	 * locate the correct protocol family
	 */
	for (i = 0; i < NPROTO; ++i)
		if (proto_table[i].family == family)
			break;
	if (i == NPROTO) {
		PRINTK("sys_socket: family not found\n");
		return -EINVAL;
	}
	ops = proto_table[i].ops;

	/*
	 * check that this is a type that we know how to manipulate and
	 * the protocol makes sense here. the family can still reject the
	 * protocol later.
	 */
	if ((type != SOCK_STREAM &&
	     type != SOCK_DGRAM &&
	     type != SOCK_SEQPACKET &&
	     type != SOCK_RAW) ||
	    protocol < 0)
		return -EINVAL;

	/*
	 * allocate the socket and allow the family to set things up. if
	 * the protocol is 0, the family is instructed to select an appropriate
	 * default.
	 */
	if (!(sock = sock_alloc(1))) {
		printk("sys_socket: no more sockets\n");
		return -EAGAIN;
	}
	sock->type = type;
	sock->ops = ops;
	if ((i = sock->ops->create(sock, protocol)) < 0) {
		sock_release(sock);
		return i;
	}

	if ((fd = get_fd(SOCK_INODE(sock))) < 0) {
		sock_release(sock);
		return -EINVAL;
	}

	return fd;
}
Esempio n. 4
0
int get_prefix(inet_prefix *dst, char *arg, int family)
{
	if (family == AF_PACKET) {
		fprintf(stderr, "Error: \"%s\" may be inet prefix, but it is not allowed in this context.\n", arg);
		exit(1);
	}
	if (get_prefix_1(dst, arg, family)) {
		fprintf(stderr, "Error: %s prefix is expected rather than \"%s\".\n",
				family_name(family) ,arg);
		exit(1);
	}
	return 0;
}
Esempio n. 5
0
File: sock.c Progetto: udhos/nepim
static int create_socket(FILE *err, int domain, int type, int protocol,
			 int pmtu_mode, int ttl, int win_recv,
			 int win_send, int nodelay, int tos, int mss,
			 int ra)
{
  int sd;
  int result;

  sd = socket(domain, type, protocol);
  if (sd < 0) {
    if (err) {
      int e = errno;
      fprintf(err, "%s: %s: socket(%s,%s,%s): errno=%d: %s\n",
	      __FILE__, __PRETTY_FUNCTION__,
	      family_name(domain), socket_type_name(type),
	      proto_name(protocol),
	      e, strerror(e));
    }

    return NEPIM_SOCK_ERR_SOCKET;
  }

  if (type == SOCK_STREAM) {
    result = nepim_socket_tcp_opt(err, domain, sd, nodelay, mss);
    if (result) {
      close(sd);
      return result;
    }
  }

  result = nepim_socket_opt(err, sd, pmtu_mode, ttl, tos, ra);
  if (result) {
    close(sd);
    return result;
  }

  result = socket_set_win_recv(sd, win_recv);
  if (result) {
    close(sd);
    return result;
  }

  result = socket_set_win_send(sd, win_send);
  if (result) {
    close(sd);
    return result;
  }

  return sd;
}
Esempio n. 6
0
File: pk2dft.c Progetto: GBert/misc
void print_device(FILE * f, device_ent_t * devpart_par) {
    int j;

    fprintf(f, "part_name                 = \"%s\"\n", devpart_par->part_name);
    fprintf(f, "family                    = \"%s\"\n", family_name(devpart_par->family));
    fprintf(f, "device_id                 = 0x%08x\n", devpart_par->device_id);
    fprintf(f, "program_mem               = 0x%08x\n", devpart_par->program_mem);
    fprintf(f, "ee_mem                    = 0x%04x\n", devpart_par->ee_mem);
    fprintf(f, "ee_addr                   = 0x%08x\n", devpart_par->ee_addr);
    fprintf(f, "config_words              = %d\n", devpart_par->config_words);
    fprintf(f, "config_addr               = 0x%08x\n", devpart_par->config_addr);
    fprintf(f, "user_id_words             = %d\n", devpart_par->user_id_words);
    fprintf(f, "user_id_addr              = 0x%08x\n", devpart_par->user_id_addr);
    fprintf(f, "bandgap_mask              = 0x%08x\n", devpart_par->bandgap_mask);

    fprintf(f, "config_masks              = {");
    for (j = 0; j < 7; j++)
	fprintf(f, "0x%04x, ", devpart_par->config_masks[j]);
    fprintf(f, "0x%04x}\n", devpart_par->config_masks[7]);

    fprintf(f, "config_blank              = {");
    for (j = 0; j < 7; j++)
	fprintf(f, "0x%04x, ", devpart_par->config_blank[j]);
    fprintf(f, "0x%04x}\n", devpart_par->config_blank[7]);

    fprintf(f, "cp_mask                   = 0x%04x\n", devpart_par->cp_mask);
    fprintf(f, "cp_config                 = 0x%04x\n", devpart_par->cp_config);
    fprintf(f, "osscal_save               = %d\n", devpart_par->osscal_save);
    fprintf(f, "ignore_address            = 0x%08x\n", devpart_par->ignore_address);
    fprintf(f, "vdd_min                   = %f\n", devpart_par->vdd_min);
    fprintf(f, "vdd_max                   = %f\n", devpart_par->vdd_max);
    fprintf(f, "vdd_erase                 = %f\n", devpart_par->vdd_erase);
    fprintf(f, "calibration_words         = %d\n", devpart_par->calibration_words);
    fprintf(f, "chip_erase_script         = \"%s\"\n", script_name(devpart_par->chip_erase_script));
    fprintf(f, "progmem_addr_set_script   = \"%s\"\n", script_name(devpart_par->progmem_addr_set_script));
    fprintf(f, "progmem_addr_bytes        = %d\n", devpart_par->progmem_addr_bytes);
    fprintf(f, "progmem_rd_script         = \"%s\"\n", script_name(devpart_par->progmem_rd_script));
    fprintf(f, "progmem_rd_words          = %d\n", devpart_par->progmem_rd_words);
    fprintf(f, "eerd_prep_script          = \"%s\"\n", script_name(devpart_par->eerd_prep_script));
    fprintf(f, "eerd_script               = \"%s\"\n", script_name(devpart_par->eerd_script));
    fprintf(f, "eerd_locations            = %d\n", devpart_par->eerd_locations);
    fprintf(f, "user_id_rd_prep_script    = \"%s\"\n", script_name(devpart_par->user_id_rd_prep_script));
    fprintf(f, "user_id_rd_script         = \"%s\"\n", script_name(devpart_par->user_id_rd_script));
    fprintf(f, "config_rd_prep_script     = \"%s\"\n", script_name(devpart_par->config_rd_prep_script));
    fprintf(f, "config_rd_script          = \"%s\"\n", script_name(devpart_par->config_rd_script));
    fprintf(f, "progmem_wr_prep_script    = \"%s\"\n", script_name(devpart_par->progmem_wr_prep_script));
    fprintf(f, "progmem_wr_script         = \"%s\"\n", script_name(devpart_par->progmem_wr_script));
    fprintf(f, "progmem_wr_words          = %d\n", devpart_par->progmem_wr_words);
    fprintf(f, "progmem_panel_bufs        = %d\n", devpart_par->progmem_panel_bufs);
    fprintf(f, "progmem_panel_offset      = %d\n", devpart_par->progmem_panel_offset);
    fprintf(f, "eewr_prep_script          = \"%s\"\n", script_name(devpart_par->eewr_prep_script));
    fprintf(f, "eewr_script               = \"%s\"\n", script_name(devpart_par->eewr_script));
    fprintf(f, "eewr_locations            = %d\n", devpart_par->eewr_locations);
    fprintf(f, "user_id_wr_prep_script    = \"%s\"\n", script_name(devpart_par->user_id_wr_prep_script));
    fprintf(f, "user_id_wr_script         = \"%s\"\n", script_name(devpart_par->user_id_wr_script));
    fprintf(f, "config_wr_prep_script     = \"%s\"\n", script_name(devpart_par->config_wr_prep_script));
    fprintf(f, "config_wr_script          = \"%s\"\n", script_name(devpart_par->config_wr_script));
    fprintf(f, "osccal_rd_script          = \"%s\"\n", script_name(devpart_par->osccal_rd_script));
    fprintf(f, "osccal_wr_script          = \"%s\"\n", script_name(devpart_par->osccal_wr_script));
    fprintf(f, "dp_mask                   = 0x%04x\n", devpart_par->dp_mask);
    fprintf(f, "write_cfg_on_erase        = %d\n", devpart_par->write_cfg_on_erase);
    fprintf(f, "blank_check_skip_usr_ids  = %d\n", devpart_par->blank_check_skip_usr_ids);
    fprintf(f, "ignore_bytes              = %d\n", devpart_par->ignore_bytes);
    fprintf(f, "chip_erase_prep_script    = \"%s\"\n", script_name(devpart_par->chip_erase_prep_script));
    fprintf(f, "boot_flash                = %d\n", devpart_par->boot_flash);
    fprintf(f, "config9_mask              = 0x%04x\n", devpart_par->config9_mask);
    fprintf(f, "config9_blank             = 0x%04x\n", devpart_par->config9_blank);
    fprintf(f, "progmem_erase_script      = \"%s\"\n", script_name(devpart_par->progmem_erase_script));
    fprintf(f, "eemem_erase_script        = \"%s\"\n", script_name(devpart_par->eemem_erase_script));
    fprintf(f, "configmem_erase_script    = \"%s\"\n", script_name(devpart_par->configmem_erase_script));
    fprintf(f, "reserved1_erase_script    = \"%s\"\n", script_name(devpart_par->reserved1_erase_script));
    fprintf(f, "reserved2_erase_script    = \"%s\"\n", script_name(devpart_par->reserved2_erase_script));
    fprintf(f, "test_memory_rd_script     = \"%s\"\n", script_name(devpart_par->test_memory_rd_script));
    fprintf(f, "test_memory_rd_words      = %d\n", devpart_par->test_memory_rd_words);
    fprintf(f, "eerow_erase_script        = \"%s\"\n", script_name(devpart_par->eerow_erase_script));
    fprintf(f, "eerow_erase_words         = %d\n", devpart_par->eerow_erase_words);
    fprintf(f, "export_to_mplab           = %d\n", devpart_par->export_to_mplab);
    fprintf(f, "debug_halt_script         = \"%s\"\n", script_name(devpart_par->debug_halt_script));
    fprintf(f, "debug_run_script          = \"%s\"\n", script_name(devpart_par->debug_run_script));
    fprintf(f, "debug_status_script       = \"%s\"\n", script_name(devpart_par->debug_status_script));
    fprintf(f, "debug_read_exec_ver_script= \"%s\"\n", script_name(devpart_par->debug_read_exec_ver_script));
    fprintf(f, "debug_single_step_script  = \"%s\"\n", script_name(devpart_par->debug_single_step_script));
    fprintf(f, "debug_bulk_wr_data_script = \"%s\"\n", script_name(devpart_par->debug_bulk_wr_data_script));
    fprintf(f, "debug_bulk_rd_data_script = \"%s\"\n", script_name(devpart_par->debug_bulk_rd_data_script));
    fprintf(f, "debug_write_vector_script = \"%s\"\n", script_name(devpart_par->debug_write_vector_script));
    fprintf(f, "debug_read_vector_script  = \"%s\"\n", script_name(devpart_par->debug_read_vector_script));
    fprintf(f, "debug_row_erase_script    = \"%s\"\n", script_name(devpart_par->debug_row_erase_script));
    fprintf(f, "debug_row_erase_size      = %d\n", devpart_par->debug_row_erase_size);
    fprintf(f, "debug_reserved5_script    = \"%s\"\n", script_name(devpart_par->debug_reserved5_script));
    fprintf(f, "debug_reserved6_script    = \"%s\"\n", script_name(devpart_par->debug_reserved6_script));
    fprintf(f, "debug_reserved7_script    = \"%s\"\n", script_name(devpart_par->debug_reserved7_script));
    fprintf(f, "debug_reserved8_script    = \"%s\"\n", script_name(devpart_par->debug_reserved8_script));
    fprintf(f, "lvp_script                = \"%s\"\n", script_name(devpart_par->lvp_script));
}
krb5_error_code smb_krb5_locator_lookup(void *private_data,
					enum locate_service_type svc,
					const char *realm,
					int socktype,
					int family,
					int (*cbfunc)(void *, int, struct sockaddr *),
					void *cbdata)
{
	krb5_error_code ret;
	struct addrinfo aihints;
	char *kdc_name = NULL;
	const char *service = get_service_from_locate_service_type(svc);

	ZERO_STRUCT(aihints);

#ifdef DEBUG_KRB5
	fprintf(stderr,"[%5u]: smb_krb5_locator_lookup: called for '%s' "
			"svc: '%s' (%d) "
			"socktype: '%s' (%d), family: '%s' (%d)\n",
			(unsigned int)getpid(), realm,
			locate_service_type_name(svc), svc,
			socktype_name(socktype), socktype,
		        family_name(family), family);
#endif
	ret = smb_krb5_locator_lookup_sanity_check(svc, realm, socktype,
						   family);
	if (ret) {
#ifdef DEBUG_KRB5
		fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "
			"returning ret: %s (%d)\n",
			(unsigned int)getpid(), error_message(ret), ret);
#endif
		return ret;
	}

	if (!winbind_env_set()) {
		if (!ask_winbind(realm, &kdc_name)) {
#ifdef DEBUG_KRB5
			fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "
				"failed to query winbindd\n",
				(unsigned int)getpid());
#endif
			goto failed;
		}
	} else {
		const char *env = NULL;
		char *var = NULL;
		if (asprintf(&var, "%s_%s",
			     WINBINDD_LOCATOR_KDC_ADDRESS, realm) == -1) {
			goto failed;
		}
		env = getenv(var);
		if (!env) {
#ifdef DEBUG_KRB5
			fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "
				"failed to get kdc from env %s\n",
				(unsigned int)getpid(), var);
#endif
			free(var);
			goto failed;
		}
		free(var);

		kdc_name = strdup(env);
		if (!kdc_name) {
			goto failed;
		}
	}
#ifdef DEBUG_KRB5
	fprintf(stderr, "[%5u]: smb_krb5_locator_lookup: "
		"got '%s' for '%s' from winbindd\n", (unsigned int)getpid(),
		kdc_name, realm);
#endif

	aihints.ai_family = family;
	aihints.ai_socktype = socktype;

	ret = smb_krb5_locator_call_cbfunc(kdc_name,
					   service,
					   &aihints,
					   cbfunc, cbdata);
	SAFE_FREE(kdc_name);

	return ret;

 failed:
	return KRB5_PLUGIN_NO_HANDLE;
}
Esempio n. 8
0
File: utils.c Progetto: dtaht/tc-adv
static const char *family_name_verbose(int family)
{
	if (family == AF_UNSPEC)
		return "any valid";
	return family_name(family);
}
Esempio n. 9
0
int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE*)arg;
	struct rtmsg *r = NLMSG_DATA(n);
	int len = n->nlmsg_len;
	struct rtattr * tb[RTA_MAX+1];
	char abuf[256];
	int host_len;
	__u32 table;
	SPRINT_BUF(b1);
	static int hz;

	if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) {
		fprintf(stderr, "Not a route: %08x %08x %08x\n",
			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
		return 0;
	}
	if (filter.flushb && n->nlmsg_type != RTM_NEWROUTE)
		return 0;
	len -= NLMSG_LENGTH(sizeof(*r));
	if (len < 0) {
		fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
		return -1;
	}

	host_len = af_bit_len(r->rtm_family);

	parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len);
	table = rtm_get_table(r, tb);

	if (!filter_nlmsg(n, tb, host_len))
		return 0;

	if (filter.flushb) {
		struct nlmsghdr *fn;
		if (NLMSG_ALIGN(filter.flushp) + n->nlmsg_len > filter.flushe) {
			if (flush_update())
				return -1;
		}
		fn = (struct nlmsghdr*)(filter.flushb + NLMSG_ALIGN(filter.flushp));
		memcpy(fn, n, n->nlmsg_len);
		fn->nlmsg_type = RTM_DELROUTE;
		fn->nlmsg_flags = NLM_F_REQUEST;
		fn->nlmsg_seq = ++rth.seq;
		filter.flushp = (((char*)fn) + n->nlmsg_len) - filter.flushb;
		filter.flushed++;
		if (show_stats < 2)
			return 0;
	}

	if (n->nlmsg_type == RTM_DELROUTE)
		fprintf(fp, "Deleted ");
	if ((r->rtm_type != RTN_UNICAST || show_details > 0) && !filter.type)
		fprintf(fp, "%s ", rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1)));

	if (tb[RTA_DST]) {
		if (r->rtm_dst_len != host_len) {
			fprintf(fp, "%s/%u ", rt_addr_n2a(r->rtm_family,
						       RTA_PAYLOAD(tb[RTA_DST]),
						       RTA_DATA(tb[RTA_DST]),
						       abuf, sizeof(abuf)),
				r->rtm_dst_len
				);
		} else {
			fprintf(fp, "%s ", format_host(r->rtm_family,
						       RTA_PAYLOAD(tb[RTA_DST]),
						       RTA_DATA(tb[RTA_DST]),
						       abuf, sizeof(abuf))
				);
		}
	} else if (r->rtm_dst_len) {
		fprintf(fp, "0/%d ", r->rtm_dst_len);
	} else {
		fprintf(fp, "default ");
	}
	if (tb[RTA_SRC]) {
		if (r->rtm_src_len != host_len) {
			fprintf(fp, "from %s/%u ", rt_addr_n2a(r->rtm_family,
						       RTA_PAYLOAD(tb[RTA_SRC]),
						       RTA_DATA(tb[RTA_SRC]),
						       abuf, sizeof(abuf)),
				r->rtm_src_len
				);
		} else {
			fprintf(fp, "from %s ", format_host(r->rtm_family,
						       RTA_PAYLOAD(tb[RTA_SRC]),
						       RTA_DATA(tb[RTA_SRC]),
						       abuf, sizeof(abuf))
				);
		}
	} else if (r->rtm_src_len) {
		fprintf(fp, "from 0/%u ", r->rtm_src_len);
	}
	if (tb[RTA_NEWDST]) {
		fprintf(fp, "as to %s ", format_host(r->rtm_family,
						  RTA_PAYLOAD(tb[RTA_NEWDST]),
						  RTA_DATA(tb[RTA_NEWDST]),
						  abuf, sizeof(abuf))
			);
	}
	if (r->rtm_tos && filter.tosmask != -1) {
		SPRINT_BUF(b1);
		fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1)));
	}

	if (tb[RTA_GATEWAY] && filter.rvia.bitlen != host_len) {
		fprintf(fp, "via %s ",
			format_host(r->rtm_family,
				    RTA_PAYLOAD(tb[RTA_GATEWAY]),
				    RTA_DATA(tb[RTA_GATEWAY]),
				    abuf, sizeof(abuf)));
	}
	if (tb[RTA_VIA]) {
		size_t len = RTA_PAYLOAD(tb[RTA_VIA]) - 2;
		struct rtvia *via = RTA_DATA(tb[RTA_VIA]);
		fprintf(fp, "via %s %s ",
			family_name(via->rtvia_family),
			format_host(via->rtvia_family, len, via->rtvia_addr,
				    abuf, sizeof(abuf)));
	}
	if (tb[RTA_OIF] && filter.oifmask != -1)
		fprintf(fp, "dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF])));

	if (!(r->rtm_flags&RTM_F_CLONED)) {
		if ((table != RT_TABLE_MAIN || show_details > 0) && !filter.tb)
			fprintf(fp, " table %s ", rtnl_rttable_n2a(table, b1, sizeof(b1)));
		if ((r->rtm_protocol != RTPROT_BOOT || show_details > 0) && filter.protocolmask != -1)
			fprintf(fp, " proto %s ", rtnl_rtprot_n2a(r->rtm_protocol, b1, sizeof(b1)));
		if ((r->rtm_scope != RT_SCOPE_UNIVERSE || show_details > 0) && filter.scopemask != -1)
			fprintf(fp, " scope %s ", rtnl_rtscope_n2a(r->rtm_scope, b1, sizeof(b1)));
	}
	if (tb[RTA_PREFSRC] && filter.rprefsrc.bitlen != host_len) {
		/* Do not use format_host(). It is our local addr
		   and symbolic name will not be useful.
		 */
		fprintf(fp, " src %s ",
			rt_addr_n2a(r->rtm_family,
				    RTA_PAYLOAD(tb[RTA_PREFSRC]),
				    RTA_DATA(tb[RTA_PREFSRC]),
				    abuf, sizeof(abuf)));
	}
	if (tb[RTA_PRIORITY])
		fprintf(fp, " metric %u ", rta_getattr_u32(tb[RTA_PRIORITY]));
	if (r->rtm_flags & RTNH_F_DEAD)
		fprintf(fp, "dead ");
	if (r->rtm_flags & RTNH_F_ONLINK)
		fprintf(fp, "onlink ");
	if (r->rtm_flags & RTNH_F_PERVASIVE)
		fprintf(fp, "pervasive ");
	if (r->rtm_flags & RTNH_F_EXTERNAL)
		fprintf(fp, "offload ");
	if (r->rtm_flags & RTM_F_NOTIFY)
		fprintf(fp, "notify ");
	if (tb[RTA_MARK]) {
		unsigned int mark = *(unsigned int*)RTA_DATA(tb[RTA_MARK]);
		if (mark) {
			if (mark >= 16)
				fprintf(fp, " mark 0x%x", mark);
			else
				fprintf(fp, " mark %u", mark);
		}
	}

	if (tb[RTA_FLOW] && filter.realmmask != ~0U) {
		__u32 to = rta_getattr_u32(tb[RTA_FLOW]);
		__u32 from = to>>16;
		to &= 0xFFFF;
		fprintf(fp, "realm%s ", from ? "s" : "");
		if (from) {
			fprintf(fp, "%s/",
				rtnl_rtrealm_n2a(from, b1, sizeof(b1)));
		}
		fprintf(fp, "%s ",
			rtnl_rtrealm_n2a(to, b1, sizeof(b1)));
	}
Esempio n. 10
0
static int print_ntable(struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE *)arg;
	struct ndtmsg *ndtm = NLMSG_DATA(n);
	int len = n->nlmsg_len;
	struct rtattr *tb[NDTA_MAX+1];
	struct rtattr *tpb[NDTPA_MAX+1];
	int ret;

	if (n->nlmsg_type != RTM_NEWNEIGHTBL) {
		fprintf(stderr, "Not NEIGHTBL: %08x %08x %08x\n",
			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
		return 0;
	}
	len -= NLMSG_LENGTH(sizeof(*ndtm));
	if (len < 0) {
		fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
		return -1;
	}

	if (preferred_family && preferred_family != ndtm->ndtm_family)
		return 0;

	parse_rtattr(tb, NDTA_MAX, NDTA_RTA(ndtm),
		     n->nlmsg_len - NLMSG_LENGTH(sizeof(*ndtm)));

	if (tb[NDTA_NAME]) {
		const char *name = rta_getattr_str(tb[NDTA_NAME]);

		if (filter.name && strcmp(filter.name, name))
			return 0;
	}

	if (tb[NDTA_PARMS]) {
		parse_rtattr(tpb, NDTPA_MAX, RTA_DATA(tb[NDTA_PARMS]),
			     RTA_PAYLOAD(tb[NDTA_PARMS]));

		if (tpb[NDTPA_IFINDEX]) {
			__u32 ifindex = rta_getattr_u32(tpb[NDTPA_IFINDEX]);

			if (filter.index && filter.index != ifindex)
				return 0;
		} else {
			if (filter.index && filter.index != NONE_DEV)
				return 0;
		}
	}

	open_json_object(NULL);
	print_string(PRINT_ANY, "family",
		     "%s ", family_name(ndtm->ndtm_family));

	if (tb[NDTA_NAME]) {
		const char *name = rta_getattr_str(tb[NDTA_NAME]);

		print_string(PRINT_ANY, "name", "%s ", name);
	}

	print_nl();

	ret = (tb[NDTA_THRESH1] || tb[NDTA_THRESH2] || tb[NDTA_THRESH3] ||
	       tb[NDTA_GC_INTERVAL]);
	if (ret)
		print_string(PRINT_FP, NULL, "    ", NULL);

	if (tb[NDTA_THRESH1]) {
		__u32 thresh1 = rta_getattr_u32(tb[NDTA_THRESH1]);

		print_uint(PRINT_ANY, "thresh1", "thresh1 %u ", thresh1);
	}

	if (tb[NDTA_THRESH2]) {
		__u32 thresh2 = rta_getattr_u32(tb[NDTA_THRESH2]);

		print_uint(PRINT_ANY, "thresh2", "thresh2 %u ", thresh2);
	}

	if (tb[NDTA_THRESH3]) {
		__u32 thresh3 = rta_getattr_u32(tb[NDTA_THRESH3]);

		print_uint(PRINT_ANY, "thresh3", "thresh3 %u ", thresh3);
	}

	if (tb[NDTA_GC_INTERVAL]) {
		__u64 gc_int = rta_getattr_u64(tb[NDTA_GC_INTERVAL]);

		print_u64(PRINT_ANY, "gc_interval", "gc_int %llu ", gc_int);
	}

	if (ret)
		print_nl();

	if (tb[NDTA_CONFIG] && show_stats)
		print_ndtconfig(RTA_DATA(tb[NDTA_CONFIG]));

	if (tb[NDTA_PARMS])
		print_ndtparams(tpb);

	if (tb[NDTA_STATS] && show_stats)
		print_ndtstats(RTA_DATA(tb[NDTA_STATS]));

	print_string(PRINT_FP, NULL, "\n", "");
	close_json_object();
	fflush(fp);

	return 0;
}