2004-10-13 Paul Jakma <paul@dishone.st>

	* (global) more const'ification.
	* sockunion.c: (sockunion_su2str) buffer should be sized
          SU_ADDRSTRLEN.
          (sockunion_log) do not return stack variables, strdup buf before
          return.
        * vty.h: Fix up the VTY_GET_INTEGER macros. Testing caller supplied
          values against ULONG_MAX is daft, when caller probably has passed
          a type that can not hold ULONG_MAX. use a temporary long instead.
          Add VTY_GET_LONG, make VTY_GET_INTEGER_RANGE use it, make
	  VTY_GET_INTEGER a define for VTY_GET_INTEGER_RANGE.
diff --git a/lib/sockunion.c b/lib/sockunion.c
index eb29ced..78e02f2 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -175,7 +175,7 @@
 }
 
 union sockunion *
-sockunion_str2su (char *str)
+sockunion_str2su (const char *str)
 {
   int ret;
   union sockunion *su;
@@ -211,7 +211,7 @@
 char *
 sockunion_su2str (union sockunion *su)
 {
-  char str[INET6_ADDRSTRLEN];
+  char str[SU_ADDRSTRLEN];
 
   switch (su->sa.sa_family)
     {
@@ -314,7 +314,7 @@
       snprintf (buf, SU_ADDRSTRLEN, "af_unknown %d ", su->sa.sa_family);
       break;
     }
-  return buf;
+  return (strdup (buf));
 }
 
 /* sockunion_connect returns
@@ -676,7 +676,7 @@
 #ifdef HAVE_IPV6
     case AF_INET6:
       {
-	char buf [64];
+	char buf [SU_ADDRSTRLEN];
 
 	printf ("%s\n", inet_ntop (AF_INET6, &(su->sin6.sin6_addr),
 				 buf, sizeof (buf)));