1 /*
2  * Copyright (c) 2003 Sun Microsystems, Inc.  All Rights Reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistribution of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistribution in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * Neither the name of Sun Microsystems, Inc. or the names of
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * This software is provided "AS IS," without a warranty of any kind.
20  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
21  * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
22  * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
23  * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
24  * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
25  * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL
26  * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
27  * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
28  * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
29  * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
30  * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
31  */
32 
33 #ifndef IPMI_LANP_H
34 #define IPMI_LANP_H
35 
36 #include <ipmitool/ipmi.h>
37 
38 #define IPMI_LAN_SET_CONFIG	0x01
39 #define IPMI_LAN_GET_CONFIG	0x02
40 #define IPMI_LAN_SUSPEND_ARP	0x03
41 # define IPMI_LAN_SUSPEND_ARP_RESP (2)
42 # define IPMI_LAN_SUSPEND_ARP_GRAT (1)
43 #define IPMI_LAN_GET_STAT	0x04
44 
45 #define IPMI_CHANNEL_NUMBER_MAX	0xe
46 
47 #define IPMI_LANP_TIMEOUT		3
48 #define IPMI_LANP_RETRIES		10
49 #define IPMI_LANP_WRITE_UNLOCK		0
50 #define IPMI_LANP_WRITE_LOCK		1
51 #define IPMI_LANP_WRITE_COMMIT		2
52 
53 enum {
54 	IPMI_LANP_SET_IN_PROGRESS,
55 	IPMI_LANP_AUTH_TYPE,
56 	IPMI_LANP_AUTH_TYPE_ENABLE,
57 	IPMI_LANP_IP_ADDR,
58 	IPMI_LANP_IP_ADDR_SRC,
59 	IPMI_LANP_MAC_ADDR,            /* 5 */
60 	IPMI_LANP_SUBNET_MASK,
61 	IPMI_LANP_IP_HEADER,
62 	IPMI_LANP_PRI_RMCP_PORT,
63 	IPMI_LANP_SEC_RMCP_PORT,
64 	IPMI_LANP_BMC_ARP,             /* 10 */
65 	IPMI_LANP_GRAT_ARP,
66 	IPMI_LANP_DEF_GATEWAY_IP,
67 	IPMI_LANP_DEF_GATEWAY_MAC,
68 	IPMI_LANP_BAK_GATEWAY_IP,
69 	IPMI_LANP_BAK_GATEWAY_MAC,     /* 15 */
70 	IPMI_LANP_SNMP_STRING,
71 	IPMI_LANP_NUM_DEST,
72 	IPMI_LANP_DEST_TYPE,
73 	IPMI_LANP_DEST_ADDR,
74 	IPMI_LANP_VLAN_ID,             /* 20 */
75 	IPMI_LANP_VLAN_PRIORITY,
76 	IPMI_LANP_RMCP_CIPHER_SUPPORT,
77 	IPMI_LANP_RMCP_CIPHERS,
78 	IPMI_LANP_RMCP_PRIV_LEVELS,
79 	IPMI_LANP_VLAN_TAGS,
80 	IPMI_LANP_BAD_PASS_THRESH,
81 	IPMI_LANP_OEM_ALERT_STRING=96,
82 	IPMI_LANP_ALERT_RETRY=97,
83 	IPMI_LANP_UTC_OFFSET=98,
84 	IPMI_LANP_DHCP_SERVER_IP=192,
85 	IPMI_LANP_DHCP_SERVER_MAC=193,
86 	IPMI_LANP_DHCP_ENABLE=194,
87 	IPMI_LANP_CHAN_ACCESS_MODE=201,
88 };
89 
90 static struct lan_param {
91 	int cmd;
92 	int size;
93 	char desc[24];
94 	uint8_t * data;
95 	int data_len;
96 } ipmi_lan_params[] __attribute__((unused)) = {
97 	{ IPMI_LANP_SET_IN_PROGRESS,	1,	"Set in Progress", NULL, 0 },
98 	{ IPMI_LANP_AUTH_TYPE,		1,	"Auth Type Support", NULL, 0 },
99 	{ IPMI_LANP_AUTH_TYPE_ENABLE,	5,	"Auth Type Enable", NULL, 0	},
100 	{ IPMI_LANP_IP_ADDR,		4,	"IP Address", NULL, 0 },
101 	{ IPMI_LANP_IP_ADDR_SRC,	1,	"IP Address Source", NULL, 0 },
102 	{ IPMI_LANP_MAC_ADDR,		6,	"MAC Address", NULL, 0 }, /* 5 */
103 	{ IPMI_LANP_SUBNET_MASK,	4,	"Subnet Mask", NULL, 0 },
104 	{ IPMI_LANP_IP_HEADER,		3,	"IP Header", NULL, 0 },
105 	{ IPMI_LANP_PRI_RMCP_PORT,	2,	"Primary RMCP Port", NULL, 0 },
106 	{ IPMI_LANP_SEC_RMCP_PORT,	2,	"Secondary RMCP Port", NULL, 0 },
107 	{ IPMI_LANP_BMC_ARP,		1,	"BMC ARP Control", NULL, 0}, /* 10 */
108 	{ IPMI_LANP_GRAT_ARP,		1,	"Gratituous ARP Intrvl", NULL, 0 },
109 	{ IPMI_LANP_DEF_GATEWAY_IP,	4,	"Default Gateway IP", NULL, 0 },
110 	{ IPMI_LANP_DEF_GATEWAY_MAC,	6,	"Default Gateway MAC", NULL, 0 },
111 	{ IPMI_LANP_BAK_GATEWAY_IP,	4,	"Backup Gateway IP", NULL, 0 },
112 	{ IPMI_LANP_BAK_GATEWAY_MAC,	6,	"Backup Gateway MAC", NULL, 0 }, /* 15 */
113 	{ IPMI_LANP_SNMP_STRING,	18,	"SNMP Community String", NULL, 0 },
114 	{ IPMI_LANP_NUM_DEST,		1,	"Number of Destinations", NULL, 0 },
115 	{ IPMI_LANP_DEST_TYPE,		4,	"Destination Type", NULL, 0 },
116 	{ IPMI_LANP_DEST_ADDR,		13,	"Destination Addresses", NULL, 0 },
117 	{ IPMI_LANP_VLAN_ID,		2,	"802.1q VLAN ID", NULL, 0 }, /* 20 */
118 	{ IPMI_LANP_VLAN_PRIORITY,	1,	"802.1q VLAN Priority", NULL, 0 },
119 	{ IPMI_LANP_RMCP_CIPHER_SUPPORT,1,	"RMCP+ Cipher Suite Count", NULL, 0 },
120 	{ IPMI_LANP_RMCP_CIPHERS,	16,	"RMCP+ Cipher Suites", NULL, 0 },
121 	{ IPMI_LANP_RMCP_PRIV_LEVELS,	9,	"Cipher Suite Priv Max", NULL, 0 },
122 	{ IPMI_LANP_BAD_PASS_THRESH,	6,	"Bad Password Threshold", NULL, 0 },
123 	{ IPMI_LANP_OEM_ALERT_STRING,	28,	"OEM Alert String", NULL, 0 }, /* 25 */
124 	{ IPMI_LANP_ALERT_RETRY,	1,	"Alert Retry Algorithm", NULL, 0 },
125 	{ IPMI_LANP_UTC_OFFSET,		3,	"UTC Offset", NULL, 0 },
126 	{ IPMI_LANP_DHCP_SERVER_IP,	4,	"DHCP Server IP", NULL, 0 },
127 	{ IPMI_LANP_DHCP_SERVER_MAC,	6,	"DHDP Server MAC", NULL, 0},
128 	{ IPMI_LANP_DHCP_ENABLE,	1,	"DHCP Enable", NULL, 0 }, /* 30 */
129 	{ IPMI_LANP_CHAN_ACCESS_MODE,	2,	"Channel Access Mode", NULL, 0 },
130 	{ -1 }
131 };
132 
133 int  ipmi_lanp_main(struct ipmi_intf *, int, char **);
134 
135 #endif /*IPMI_LANP_H*/
136