Add support for setting VLAN id and priority

This commit is contained in:
Duncan Laurie 2006-03-19 18:37:16 +00:00
parent 64af2f2bdb
commit 56c495455c
3 changed files with 102 additions and 1 deletions

View File

@ -8,6 +8,7 @@ version 1.8.7
* Disable file paranoia checks on read files by default
* Support IPMIv2 SOL on older Intel boxes
* Display message and exit if keepalive fails during SOL
* Add support for setting VLAN id and priority
version 1.8.6
* Fix memory corruption when sending encrypted SOL traffic

View File

@ -750,6 +750,20 @@ Set BMC generated gratuitous ARPs.
Set BMC generated gratuitous ARP interval.
.TP
\fIvlan id\fP <\fBoff\fR|\fBid\fR>
.br
Disable VLAN operation or enable VLAN and set the ID.
.br
ID: value of the virtual lan identifier between 1 and 4094 inclusive.
.TP
\fIvlan priority\fP <\fBpriority\fR>
.br
Set the priority associated with VLAN frames.
.br
ID: priority of the virtual lan frames between 0 and 7 inclusive.
.TP
\fIauth\fP <\fBlevel\fR,\fB...\fR> <\fBtype\fR,\fB...\fR>
.br

View File

@ -733,6 +733,19 @@ ipmi_lan_print(struct ipmi_intf * intf, uint8_t chan)
printf("%-24s: %02x:%02x:%02x:%02x:%02x:%02x\n", p->desc,
p->data[0], p->data[1], p->data[2], p->data[3], p->data[4], p->data[5]);
p = get_lan_param(intf, chan, IPMI_LANP_VLAN_ID);
if (p != NULL && p->data != NULL) {
int id = ((p->data[1] & 0x0f) << 8) + p->data[0];
if (p->data[1] & 0x80)
printf("%-24s: %d\n", p->desc, id);
else
printf("%-24s: Disabled\n", p->desc);
}
p = get_lan_param(intf, chan, IPMI_LANP_VLAN_PRIORITY);
if (p != NULL && p->data != NULL)
printf("%-24s: %d\n", p->desc, p->data[0] & 0x07);
/* Determine supported Cipher Suites -- Requires two calls */
p = get_lan_param(intf, chan, IPMI_LANP_RMCP_CIPHER_SUPPORT);
if (p == NULL)
@ -1205,9 +1218,11 @@ static void ipmi_lan_set_usage(void)
lprintf(LOG_NOTICE, " user Enable default user for this channel");
lprintf(LOG_NOTICE, " access <on|off> Enable or disable access to this channel");
lprintf(LOG_NOTICE, " alert <on|off> Enable or disable PEF alerting for this channel");
lprintf(LOG_NOTICE, " arp response <on|off> Enable or disable BMC ARP responding");
lprintf(LOG_NOTICE, " arp respond <on|off> Enable or disable BMC ARP responding");
lprintf(LOG_NOTICE, " arp generate <on|off> Enable or disable BMC gratuitous ARP generation");
lprintf(LOG_NOTICE, " arp interval <seconds> Set gratuitous ARP generation interval");
lprintf(LOG_NOTICE, " vlan id <off|<id>> Disable or enable VLAN and set ID (1-4094)");
lprintf(LOG_NOTICE, " vlan priority <priority> Set vlan priority (0-7)");
lprintf(LOG_NOTICE, " auth <level> <type,..> Set channel authentication types");
lprintf(LOG_NOTICE, " level = CALLBACK, USER, OPERATOR, ADMIN");
lprintf(LOG_NOTICE, " type = NONE, MD2, MD5, PASSWORD, OEM");
@ -1225,6 +1240,57 @@ static void ipmi_lan_set_usage(void)
lprintf(LOG_NOTICE, " O = OEM\n");
}
static void
ipmi_lan_set_vlan_usage(void)
{
lprintf(LOG_NOTICE,
"lan set <channel> vlan id <id>\n"
"lan set <channel> vlan id off\n"
"lan set <channel> vlan priority <priority>\n");
}
static int
ipmi_lan_set_vlan_id(struct ipmi_intf * intf, uint8_t chan, char *string)
{
uint8_t data[2];
int rc;
if (string == NULL) {
data[0] = 0;
data[1] = 0;
}
else {
int id = atoi(string);
if (id < 1 || id > 4094) {
lprintf(LOG_NOTICE, "vlan id must be between 1 and 4094.");
return -1;
}
else {
data[0] = (uint8_t)id;
data[1] = (uint8_t)(id >> 8) | 0x80;
}
}
rc = set_lan_param(intf, chan, IPMI_LANP_VLAN_ID, data, 2);
return rc;
}
static int
ipmi_lan_set_vlan_priority(struct ipmi_intf * intf, uint8_t chan, char *string)
{
uint8_t data;
int rc;
int priority = atoi(string);
if (priority < 0 || priority > 7) {
lprintf(LOG_NOTICE, "vlan priority must be between 0 and 7.");
return -1;
}
data = (uint8_t)priority;
rc = set_lan_param(intf, chan, IPMI_LANP_VLAN_PRIORITY, &data, 1);
return rc;
}
static int
ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
{
@ -1333,6 +1399,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
" static = static address (manually configured)\n"
" dhcp = address obtained by BMC running DHCP\n"
" bios = address loaded by BIOS or system software\n");
return 0;
}
else if (strncmp(argv[2], "none", 4) == 0)
data[0] = 0;
@ -1433,6 +1500,25 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv)
rc = set_lan_param(intf, chan, IPMI_LANP_BAK_GATEWAY_MAC, data, 6);
}
}
else if (strncasecmp(argv[1], "vlan", 4) == 0) {
if (argc < 4 || strncmp(argv[2], "help", 4) == 0) {
ipmi_lan_set_vlan_usage();
}
else if (strncasecmp(argv[2], "id", 2) == 0) {
if (strncasecmp(argv[3], "off", 3) == 0) {
ipmi_lan_set_vlan_id(intf, chan, NULL);
}
else {
ipmi_lan_set_vlan_id(intf, chan, argv[3]);
}
}
else if (strncasecmp(argv[2], "priority", 8) == 0) {
ipmi_lan_set_vlan_priority(intf, chan, argv[3]);
}
else {
ipmi_lan_set_vlan_usage();
}
}
/* set PEF alerting on or off */
else if (strncasecmp(argv[1], "alert", 5) == 0) {
if (argc < 3) {