summaryrefslogtreecommitdiff
path: root/debian/patches/10_ipmi_lanp
blob: 7bd5f97694c22358dd75c8c92baa9b77c9b18f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## 10_ipmi_lanp.dpatch by  <mjj29@debian.org>
##
## 10_ipmi_lanp closes #389741
--- ipmitool-1.8.9.orig/lib/ipmi_lanp.c	2007-03-06 22:15:36.000000000 +0000
+++ ipmitool-1.8.9/lib/ipmi_lanp.c	2007-12-13 10:06:18.045813387 +0000
@@ -1489,28 +1489,43 @@
 		}
 	}
 	/* ip address */
-	else if ((strncmp(argv[1], "ipaddr", 6) == 0) &&
-		 (get_cmdline_ipaddr(argv[2], data) == 0)) {
-		printf("Setting LAN %s to %d.%d.%d.%d\n",
-		       ipmi_lan_params[IPMI_LANP_IP_ADDR].desc,
-		       data[0], data[1], data[2], data[3]);
-		rc = set_lan_param(intf, chan, IPMI_LANP_IP_ADDR, data, 4);
+	else if (strncmp(argv[1], "ipaddr", 6) == 0) {
+		if ( argc < 3 || strncmp(argv[2], "help", 4) == 0 ||
+				get_cmdline_ipaddr(argv[2], data) != 0 ) {
+			lprintf(LOG_NOTICE, "lan set <channel> ipaddr <x.x.x.x>");
+		}
+		else {
+			printf("Setting LAN %s to %d.%d.%d.%d\n",
+					ipmi_lan_params[IPMI_LANP_IP_ADDR].desc,
+					data[0], data[1], data[2], data[3]);
+			rc = set_lan_param(intf, chan, IPMI_LANP_IP_ADDR, data, 4);
+		}
 	}
 	/* network mask */
-	else if ((strncmp(argv[1], "netmask", 7) == 0) &&
-		 (get_cmdline_ipaddr(argv[2], data) == 0)) {
-		printf("Setting LAN %s to %d.%d.%d.%d\n",
-		       ipmi_lan_params[IPMI_LANP_SUBNET_MASK].desc,
-		       data[0], data[1], data[2], data[3]);
-		rc = set_lan_param(intf, chan, IPMI_LANP_SUBNET_MASK, data, 4);
+	else if (strncmp(argv[1], "netmask", 7) == 0) {
+		if ( argc < 3 || strncmp(argv[2], "help", 4) == 0 ||
+				get_cmdline_ipaddr(argv[2], data) != 0 ) {
+			lprintf(LOG_NOTICE, "lan set <channel> netmask <x.x.x.x>");
+		}
+		else {
+			printf("Setting LAN %s to %d.%d.%d.%d\n",
+					ipmi_lan_params[IPMI_LANP_SUBNET_MASK].desc,
+					data[0], data[1], data[2], data[3]);
+			rc = set_lan_param(intf, chan, IPMI_LANP_SUBNET_MASK, data, 4);
+		}
 	}
 	/* mac address */
-	else if ((strncmp(argv[1], "macaddr", 7) == 0) &&
-		 (get_cmdline_macaddr(argv[2], data) == 0)) {
-		printf("Setting LAN %s to %02x:%02x:%02x:%02x:%02x:%02x\n",
-		       ipmi_lan_params[IPMI_LANP_MAC_ADDR].desc,
-		       data[0], data[1], data[2], data[3], data[4], data[5]);
-		rc = set_lan_param(intf, chan, IPMI_LANP_MAC_ADDR, data, 6);
+	else if (strncmp(argv[1], "macaddr", 7) == 0) {
+		if ( argc < 3 || strncmp(argv[2], "help", 4) == 0 ||
+				get_cmdline_macaddr(argv[2], data) != 0 ) {
+			lprintf(LOG_NOTICE, "lan set <channel> macaddr <x:x:x:x:x:x>");
+		}
+		else {
+			printf("Setting LAN %s to %02x:%02x:%02x:%02x:%02x:%02x\n",
+					ipmi_lan_params[IPMI_LANP_MAC_ADDR].desc,
+					data[0], data[1], data[2], data[3], data[4], data[5]);
+			rc = set_lan_param(intf, chan, IPMI_LANP_MAC_ADDR, data, 6);
+		}
 	}
 	/* default gateway settings */
 	else if (strncmp(argv[1], "defgw", 5) == 0) {