changeset 12309:e1038eb75bcf

6940640 flowadm minimum maxbw error message is not self consistent 6940643 flowadm doesn't give a useful error message if a port is specified without a transport
author Michael Lim <Michael.Lim@Sun.COM>
date Tue, 04 May 2010 17:11:30 -0700
parents 4150d9d3c1ce
children f87d8e83d301
files usr/src/lib/libdladm/common/flowattr.c usr/src/lib/libdladm/common/libdladm.c usr/src/lib/libdladm/common/libdladm.h
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libdladm/common/flowattr.c	Tue May 04 15:44:29 2010 -0700
+++ b/usr/src/lib/libdladm/common/flowattr.c	Tue May 04 17:11:30 2010 -0700
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <errno.h>
@@ -254,6 +253,16 @@
 				return (status);
 		}
 	}
+
+	/*
+	 * Make sure protocol is specified if either local or
+	 * remote port is specified.
+	 */
+	if ((flowdesc->fd_mask &
+	    (FLOW_ULP_PORT_LOCAL | FLOW_ULP_PORT_REMOTE)) != 0 &&
+	    (flowdesc->fd_mask & FLOW_IP_PROTOCOL) == 0)
+		return (DLADM_STATUS_PORT_NOPROTO);
+
 	return (status);
 }
 
--- a/usr/src/lib/libdladm/common/libdladm.c	Tue May 04 15:44:29 2010 -0700
+++ b/usr/src/lib/libdladm/common/libdladm.c	Tue May 04 17:11:30 2010 -0700
@@ -355,7 +355,7 @@
 		s = "invalid property";
 		break;
 	case DLADM_STATUS_MINMAXBW:
-		s = "minimum value for maxbw is 1.2M";
+		s = "minimum value for maxbw is 1200K";
 		break;
 	case DLADM_STATUS_NO_HWRINGS:
 		s = "request hw rings failed";
@@ -405,6 +405,9 @@
 	case DLADM_STATUS_INVALID_PKEY_TBL_SIZE:
 		s = "invalid PKEY table size";
 		break;
+	case DLADM_STATUS_PORT_NOPROTO:
+		s = "local or remote port requires transport";
+		break;
 	default:
 		s = "<unknown error>";
 		break;
--- a/usr/src/lib/libdladm/common/libdladm.h	Tue May 04 15:44:29 2010 -0700
+++ b/usr/src/lib/libdladm/common/libdladm.h	Tue May 04 17:11:30 2010 -0700
@@ -168,7 +168,8 @@
 	DLADM_STATUS_PARTITION_EXISTS,
 	DLADM_STATUS_INVALID_PKEY,
 	DLADM_STATUS_NO_IB_HW_RESOURCE,
-	DLADM_STATUS_INVALID_PKEY_TBL_SIZE
+	DLADM_STATUS_INVALID_PKEY_TBL_SIZE,
+	DLADM_STATUS_PORT_NOPROTO
 } dladm_status_t;
 
 typedef enum {