2005-06-03 Paul Jakma <paul.jakma@sun.com>

	* ripd.c: (rip_create_socket) move it up so rip_send_packet
	  can use it too.
diff --git a/ripd/ChangeLog b/ripd/ChangeLog
index 5d2c164..ebd9325 100644
--- a/ripd/ChangeLog
+++ b/ripd/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-03 Paul Jakma <paul.jakma@sun.com>
+
+	* ripd.c: (rip_create_socket) move it up so rip_send_packet
+	  can use it too.
+
 2005-06-01 Paul Jakma <paul.jakma@sun.com>
 
 	* rip_interface.c: Fix authentication, no-auth impossible to specify
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 4723ebe..c40e2ac 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1319,6 +1319,62 @@
     }
 }
 
+/* Make socket for RIP protocol. */
+int 
+rip_create_socket ()
+{
+  int ret;
+  int sock;
+  struct sockaddr_in addr;
+  struct servent *sp;
+
+  memset (&addr, 0, sizeof (struct sockaddr_in));
+
+  /* Set RIP port. */
+  sp = getservbyname ("router", "udp");
+  if (sp) 
+    addr.sin_port = sp->s_port;
+  else 
+    addr.sin_port = htons (RIP_PORT_DEFAULT);
+
+  /* Address shoud be any address. */
+  addr.sin_family = AF_INET;
+  addr.sin_addr.s_addr = INADDR_ANY;
+
+  /* Make datagram socket. */
+  sock = socket (AF_INET, SOCK_DGRAM, 0);
+  if (sock < 0) 
+    {
+      zlog_err("Cannot create UDP socket: %s", safe_strerror(errno));
+      exit (1);
+    }
+
+  sockopt_broadcast (sock);
+  sockopt_reuseaddr (sock);
+  sockopt_reuseport (sock);
+  setsockopt_so_recvbuf (sock, RIP_UDP_RCV_BUF);
+#ifdef RIP_RECVMSG
+  setsockopt_pktinfo (sock);
+#endif /* RIP_RECVMSG */
+
+  if (ripd_privs.change (ZPRIVS_RAISE))
+      zlog_err ("rip_create_socket: could not raise privs");
+  ret = bind (sock, (struct sockaddr *) & addr, sizeof (addr));
+  if (ret < 0)
+    {
+      int save_errno = errno;
+      if (ripd_privs.change (ZPRIVS_LOWER))
+        zlog_err ("rip_create_socket: could not lower privs");
+      zlog_err("cannot bind to port %d: %s",
+	       (int)ntohs(addr.sin_port), safe_strerror(save_errno));
+      return ret;
+    }
+  if (ripd_privs.change (ZPRIVS_LOWER))
+      zlog_err ("rip_create_socket: could not lower privs");
+      
+  return sock;
+}
+
 /* RIP packet send to destination address, on interface denoted by
  * by connected argument. NULL to argument denotes destination should be
  * should be RIP multicast group
@@ -2004,63 +2060,6 @@
   return len;
 }
 
-/* Make socket for RIP protocol. */
-int 
-rip_create_socket ()
-{
-  int ret;
-  int sock;
-  struct sockaddr_in addr;
-  struct servent *sp;
-
-  memset (&addr, 0, sizeof (struct sockaddr_in));
-
-  /* Set RIP port. */
-  sp = getservbyname ("router", "udp");
-  if (sp) 
-    addr.sin_port = sp->s_port;
-  else 
-    addr.sin_port = htons (RIP_PORT_DEFAULT);
-
-  /* Address shoud be any address. */
-  addr.sin_family = AF_INET;
-  addr.sin_addr.s_addr = INADDR_ANY;
-
-  /* Make datagram socket. */
-  sock = socket (AF_INET, SOCK_DGRAM, 0);
-  if (sock < 0) 
-    {
-      zlog_err("Cannot create UDP socket: %s", safe_strerror(errno));
-      exit (1);
-    }
-
-  sockopt_broadcast (sock);
-  sockopt_reuseaddr (sock);
-  sockopt_reuseport (sock);
-  setsockopt_so_recvbuf (sock, RIP_UDP_RCV_BUF);
-#ifdef RIP_RECVMSG
-  setsockopt_pktinfo (sock);
-#endif /* RIP_RECVMSG */
-
-  if (ripd_privs.change (ZPRIVS_RAISE))
-      zlog_err ("rip_create_socket: could not raise privs");
-  ret = bind (sock, (struct sockaddr *) & addr, sizeof (addr));
-  if (ret < 0)
-    {
-      int save_errno = errno;
-      if (ripd_privs.change (ZPRIVS_LOWER))
-        zlog_err ("rip_create_socket: could not lower privs");
-      zlog_err("cannot bind to port %d: %s",
-	       (int)ntohs(addr.sin_port), safe_strerror(save_errno));
-      return ret;
-    }
-  if (ripd_privs.change (ZPRIVS_LOWER))
-      zlog_err ("rip_create_socket: could not lower privs");
-      
-  return sock;
-}
-
-
 /* Write routing table entry to the stream and return next index of
    the routing table entry in the stream. */
 int