Пример #1
0
static int
igs_cfg_bridge_add(char *argv[])
{
	igs_cfg_request_t req;

	bzero((char *)&req, sizeof(igs_cfg_request_t));

	strcpy((char *)req.inst_id, argv[3]);
	req.command_id = IGSCFG_CMD_BR_ADD;
	req.oper_type = IGSCFG_OPER_TYPE_SET;

	/* Send request to kernel */
	if (igs_cfg_request_send(&req, sizeof(igs_cfg_request_t)) < 0)
	{
		fprintf(stderr, "Unable to send request to IGS\n");
		return (FAILURE);
	}

	if (req.status != IGSCFG_STATUS_SUCCESS)
	{
		fprintf(stderr, "%s\n", req.arg);
		return (FAILURE);
	}

	return (SUCCESS);
}
Пример #2
0
static int
igs_cfg_sdb_list(char *argv[])
{
	igs_cfg_request_t req;
	igs_cfg_sdb_list_t *list;
	bool first_row = TRUE;
	int32 i;

	strncpy((char *)req.inst_id, argv[3], sizeof(req.inst_id)-1);
	req.inst_id[sizeof(req.inst_id)-1] = '\0';

	req.command_id = IGSCFG_CMD_IGSDB_LIST;
	req.oper_type = IGSCFG_OPER_TYPE_GET;
	req.size = sizeof(req.arg);
	list = (igs_cfg_sdb_list_t *)req.arg;

	if (igs_cfg_request_send(&req, sizeof(igs_cfg_request_t)) < 0)
	{
		fprintf(stderr, "Unable to send request to IGS\n");
		return (FAILURE);
	}

	if (req.status != IGSCFG_STATUS_SUCCESS)
	{
		fprintf(stderr, "Unable to get the IGSDB list\n");
		fprintf(stderr, "%s\n", req.arg);
		return (FAILURE);
	}

	fprintf(stdout, "Group           Members         Interface\n");

	for (i = 0; i < list->num_entries; i++)
	{
		first_row = TRUE;
		fprintf(stdout, "%08x        ", list->sdb_entry[i].mgrp_ip);
		if (first_row)
		{
			fprintf(stdout, "%08x        ", list->sdb_entry[i].mh_ip);
			fprintf(stdout, "%s\n", list->sdb_entry[i].if_name);
			first_row = FALSE;
			continue;
		}
		fprintf(stdout, "                ");
		fprintf(stdout, "%08x        ", list->sdb_entry[i].mh_ip);
		fprintf(stdout, "%s\n", list->sdb_entry[i].if_name);
	}

	return (SUCCESS);
}
Пример #3
0
static int
igs_cfg_rtport_list(char *argv[])
{
	igs_cfg_request_t req;
	igs_cfg_rtport_list_t *list;
	int32 i;

	bzero((char *)&req, sizeof(igs_cfg_request_t));

	strcpy((char *)req.inst_id, argv[3]);
	req.command_id = IGSCFG_CMD_RTPORT_LIST;
	req.oper_type = IGSCFG_OPER_TYPE_GET;
	req.size = sizeof(req.arg);

	/* Send request to kernel */
	if (igs_cfg_request_send(&req, sizeof(igs_cfg_request_t)) < 0)
	{
		fprintf(stderr, "Unable to send request to IGS\n");
		return (FAILURE);
	}

	if (req.status != IGSCFG_STATUS_SUCCESS)
	{
		fprintf(stderr, "%s\n", req.arg);
		return (FAILURE);
	}

	fprintf(stdout, "Router          Interface\n");

	list = (igs_cfg_rtport_list_t *)req.arg;
	for (i = 0; i < list->num_entries; i++)
	{
		fprintf(stdout, "%08x        ", list->rtport_entry[i].mr_ip);
		fprintf(stdout, "%-15s", list->rtport_entry[i].if_name);
	}

	fprintf(stdout, "\n");

	return (SUCCESS);
}
Пример #4
0
static int
igs_cfg_stats_show(char *argv[])
{
	igs_cfg_request_t req;
	igs_stats_t *igss;

	strncpy((char *)req.inst_id, argv[3], sizeof(req.inst_id)-1);
	req.inst_id[sizeof(req.inst_id)-1] = '\0';

	req.command_id = IGSCFG_CMD_IGS_STATS;
	req.oper_type = IGSCFG_OPER_TYPE_GET;
	req.size = sizeof(igs_stats_t);
	igss = (igs_stats_t *)req.arg;

	if (igs_cfg_request_send(&req, sizeof(igs_cfg_request_t)) < 0)
	{
		fprintf(stderr, "Unable to send request to IGS\n");
		return (FAILURE);
	}

	if (req.status != IGSCFG_STATUS_SUCCESS)
	{
		fprintf(stderr, "Unable to get the IGS stats\n");
		return (FAILURE);
	}

	fprintf(stdout, "IgmpPkts        IgmpQueries     "
	        "IgmpReports     IgmpV2Reports   IgmpLeaves\n");
	fprintf(stdout, "%-15d %-15d %-15d %-15d %d\n",
	        igss->igmp_packets, igss->igmp_queries,
	        igss->igmp_reports, igss->igmp_v2reports,
	        igss->igmp_leaves);
	fprintf(stdout, "IgmpNotHandled  McastGroups     "
	        "McastMembers    MemTimeouts\n");
	fprintf(stdout, "%-15d %-15d %-15d %d\n",
	        igss->igmp_not_handled, igss->igmp_mcast_groups,
	        igss->igmp_mcast_members, igss->igmp_mem_timeouts);

	return (SUCCESS);
}