]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Use local_port and remote_port instead of server_port and server_port + 1
authorTed Lemon <source@isc.org>
Tue, 18 Feb 1997 14:32:51 +0000 (14:32 +0000)
committerTed Lemon <source@isc.org>
Tue, 18 Feb 1997 14:32:51 +0000 (14:32 +0000)
12 files changed:
bpf.c
common/bpf.c
common/nit.c
common/packet.c
common/raw.c
common/socket.c
dhcpd.c
nit.c
packet.c
raw.c
server/dhcpd.c
socket.c

diff --git a/bpf.c b/bpf.c
index c0d802b8dbfa9ba30f65ac0d53c24eb2d6799008..f59806d00d773dc5bd10fd44a6f53caa92a7b395 100644 (file)
--- a/bpf.c
+++ b/bpf.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.14 1997/01/02 12:00:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.15 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -211,7 +211,7 @@ void if_register_receive (info, interface)
         /* Patch the server port into the BPF  program...
           XXX changes to filter program may require changes
           to the insn number(s) used below! XXX */
-       filter [8].k = ntohs (server_port);
+       filter [8].k = ntohs (local_port);
 
        if (ioctl (info -> rfdesc, BIOCSETF, &p) < 0)
                error ("Can't install packet filter program: %m");
index c0d802b8dbfa9ba30f65ac0d53c24eb2d6799008..f59806d00d773dc5bd10fd44a6f53caa92a7b395 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.14 1997/01/02 12:00:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.15 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -211,7 +211,7 @@ void if_register_receive (info, interface)
         /* Patch the server port into the BPF  program...
           XXX changes to filter program may require changes
           to the insn number(s) used below! XXX */
-       filter [8].k = ntohs (server_port);
+       filter [8].k = ntohs (local_port);
 
        if (ioctl (info -> rfdesc, BIOCSETF, &p) < 0)
                error ("Can't install packet filter program: %m");
index 0de8d62bce0815b36028191eadbfb911b8fad547..9b1dc06f43ffbde77afa93701db0c7cb226c80c7 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: nit.c,v 1.10 1997/01/02 12:00:17 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: nit.c,v 1.11 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -212,7 +212,7 @@ void if_register_receive (info, interface)
        pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_CAND;
        pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHWORD + 18;
        pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHLIT + ENF_CAND;
-       pf.Pf_Filter [pf.Pf_FilterLen++] = server_port;
+       pf.Pf_Filter [pf.Pf_FilterLen++] = local_port;
 
        /* Install the filter... */
        sio.ic_cmd = NIOCSETF;
index 2d6238b412ff368c916dabd6fc591b03108f7834..1fc9a0bbec66e3f5466326394d968c756f8973c5 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: packet.c,v 1.11 1996/08/27 09:53:14 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: packet.c,v 1.12 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -189,7 +189,7 @@ void assemble_udp_ip_header (interface, buf, bufix,
        *bufix += sizeof ip;
 
        /* Fill out the UDP header */
-       udp.uh_sport = server_port;             /* XXX */
+       udp.uh_sport = local_port;              /* XXX */
        udp.uh_dport = port;                    /* XXX */
        udp.uh_ulen = htons(sizeof(udp) + len);
        memset (&udp.uh_sum, 0, sizeof udp.uh_sum);
@@ -264,7 +264,7 @@ size_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
          return -1;
 
   /* Is it to the port we're serving? */
-  if (udp -> uh_dport != server_port)
+  if (udp -> uh_dport != local_port)
          return -1;
 #endif /* USERLAND_FILTER */
 
index b49d4d94fffab29f55c43624cc4f00c195fb88d1..148408e0217f637e80ad9caa2adc6d81a0f9fc57 100644 (file)
@@ -54,7 +54,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: raw.c,v 1.8 1996/09/04 07:06:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: raw.c,v 1.9 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -74,13 +74,13 @@ void if_register_send (info, interface)
 
        /* Set up the address we're going to connect to. */
        name.sin_family = AF_INET;
-       name.sin_port = server_port;
+       name.sin_port = local_port;
        name.sin_addr.s_addr = htonl (INADDR_BROADCAST);
        memset (name.sin_zero, 0, sizeof (name.sin_zero));
 
        /* List addresses on which we're listening. */
        note ("Sending on %s, port %d",
-             piaddr (info -> address), htons (server_port));
+             piaddr (info -> address), htons (local_port));
        if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
                error ("Can't create dhcp socket: %m");
 
index 7e7bc912ac8f57cecc062d8333710ac171d714b2..3e3121b5eddabf77dcc72b44e115826e10724cd8 100644 (file)
@@ -50,7 +50,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: socket.c,v 1.17 1997/01/02 12:00:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: socket.c,v 1.18 1997/02/18 14:30:13 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -87,7 +87,7 @@ int if_register_socket (info, interface)
 
        /* Set up the address we're going to bind to. */
        name.sin_family = AF_INET;
-       name.sin_port = server_port;
+       name.sin_port = local_port;
        name.sin_addr.s_addr = INADDR_ANY;
        memset (name.sin_zero, 0, sizeof (name.sin_zero));
 
diff --git a/dhcpd.c b/dhcpd.c
index b46b74bb5dbd0371ae4a06d77cf0092ab762ba9e..941c4bb0cb3eac8f5b0a85e94d59847f15f78da8 100644 (file)
--- a/dhcpd.c
+++ b/dhcpd.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhcpd.c,v 1.36 1996/09/12 09:28:13 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.37 1997/02/18 14:30:11 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
 #endif
 
 static char copyright[] =
@@ -64,7 +64,9 @@ int server_identifier_matched;
 struct interface_info fallback_interface;
 #endif
 
-u_int16_t server_port;
+u_int16_t local_port;
+u_int16_t remote_port;
+
 int log_priority;
 #ifdef DEBUG
 int log_perror = -1;
@@ -119,9 +121,9 @@ int main (argc, argv, envp)
                        if (status < 1 || status > 65535)
                                error ("%s: not a valid UDP port",
                                       argv [i]);
-                       server_port = htons (status);
+                       local_port = htons (status);
                        debug ("binding to user-specified port %d",
-                              ntohs (server_port));
+                              ntohs (local_port));
                } else if (!strcmp (argv [i], "-f")) {
 #ifndef DEBUG
                        daemon = 0;
@@ -200,16 +202,18 @@ int main (argc, argv, envp)
 #endif /* !DEBUG */
 
        /* Default to the DHCP/BOOTP port. */
-       if (!server_port)
+       if (!local_port)
        {
                ent = getservbyname ("dhcp", "udp");
                if (!ent)
-                       server_port = htons (67);
+                       local_port = htons (67);
                else
-                       server_port = ent -> s_port;
+                       local_port = ent -> s_port;
                endservent ();
        }
   
+       remote_port = htons (ntohs (local_port) + 1);
+
        /* Get the current time... */
        GET_TIME (&cur_time);
 
diff --git a/nit.c b/nit.c
index 0de8d62bce0815b36028191eadbfb911b8fad547..9b1dc06f43ffbde77afa93701db0c7cb226c80c7 100644 (file)
--- a/nit.c
+++ b/nit.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: nit.c,v 1.10 1997/01/02 12:00:17 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: nit.c,v 1.11 1997/02/18 14:30:12 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -212,7 +212,7 @@ void if_register_receive (info, interface)
        pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_CAND;
        pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHWORD + 18;
        pf.Pf_Filter [pf.Pf_FilterLen++] = ENF_PUSHLIT + ENF_CAND;
-       pf.Pf_Filter [pf.Pf_FilterLen++] = server_port;
+       pf.Pf_Filter [pf.Pf_FilterLen++] = local_port;
 
        /* Install the filter... */
        sio.ic_cmd = NIOCSETF;
index 2d6238b412ff368c916dabd6fc591b03108f7834..1fc9a0bbec66e3f5466326394d968c756f8973c5 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: packet.c,v 1.11 1996/08/27 09:53:14 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: packet.c,v 1.12 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -189,7 +189,7 @@ void assemble_udp_ip_header (interface, buf, bufix,
        *bufix += sizeof ip;
 
        /* Fill out the UDP header */
-       udp.uh_sport = server_port;             /* XXX */
+       udp.uh_sport = local_port;              /* XXX */
        udp.uh_dport = port;                    /* XXX */
        udp.uh_ulen = htons(sizeof(udp) + len);
        memset (&udp.uh_sum, 0, sizeof udp.uh_sum);
@@ -264,7 +264,7 @@ size_t decode_udp_ip_header (interface, buf, bufix, from, data, len)
          return -1;
 
   /* Is it to the port we're serving? */
-  if (udp -> uh_dport != server_port)
+  if (udp -> uh_dport != local_port)
          return -1;
 #endif /* USERLAND_FILTER */
 
diff --git a/raw.c b/raw.c
index b49d4d94fffab29f55c43624cc4f00c195fb88d1..148408e0217f637e80ad9caa2adc6d81a0f9fc57 100644 (file)
--- a/raw.c
+++ b/raw.c
@@ -54,7 +54,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: raw.c,v 1.8 1996/09/04 07:06:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: raw.c,v 1.9 1997/02/18 14:32:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -74,13 +74,13 @@ void if_register_send (info, interface)
 
        /* Set up the address we're going to connect to. */
        name.sin_family = AF_INET;
-       name.sin_port = server_port;
+       name.sin_port = local_port;
        name.sin_addr.s_addr = htonl (INADDR_BROADCAST);
        memset (name.sin_zero, 0, sizeof (name.sin_zero));
 
        /* List addresses on which we're listening. */
        note ("Sending on %s, port %d",
-             piaddr (info -> address), htons (server_port));
+             piaddr (info -> address), htons (local_port));
        if ((sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
                error ("Can't create dhcp socket: %m");
 
index b46b74bb5dbd0371ae4a06d77cf0092ab762ba9e..941c4bb0cb3eac8f5b0a85e94d59847f15f78da8 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhcpd.c,v 1.36 1996/09/12 09:28:13 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.37 1997/02/18 14:30:11 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
 #endif
 
 static char copyright[] =
@@ -64,7 +64,9 @@ int server_identifier_matched;
 struct interface_info fallback_interface;
 #endif
 
-u_int16_t server_port;
+u_int16_t local_port;
+u_int16_t remote_port;
+
 int log_priority;
 #ifdef DEBUG
 int log_perror = -1;
@@ -119,9 +121,9 @@ int main (argc, argv, envp)
                        if (status < 1 || status > 65535)
                                error ("%s: not a valid UDP port",
                                       argv [i]);
-                       server_port = htons (status);
+                       local_port = htons (status);
                        debug ("binding to user-specified port %d",
-                              ntohs (server_port));
+                              ntohs (local_port));
                } else if (!strcmp (argv [i], "-f")) {
 #ifndef DEBUG
                        daemon = 0;
@@ -200,16 +202,18 @@ int main (argc, argv, envp)
 #endif /* !DEBUG */
 
        /* Default to the DHCP/BOOTP port. */
-       if (!server_port)
+       if (!local_port)
        {
                ent = getservbyname ("dhcp", "udp");
                if (!ent)
-                       server_port = htons (67);
+                       local_port = htons (67);
                else
-                       server_port = ent -> s_port;
+                       local_port = ent -> s_port;
                endservent ();
        }
   
+       remote_port = htons (ntohs (local_port) + 1);
+
        /* Get the current time... */
        GET_TIME (&cur_time);
 
index 7e7bc912ac8f57cecc062d8333710ac171d714b2..3e3121b5eddabf77dcc72b44e115826e10724cd8 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -50,7 +50,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: socket.c,v 1.17 1997/01/02 12:00:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: socket.c,v 1.18 1997/02/18 14:30:13 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -87,7 +87,7 @@ int if_register_socket (info, interface)
 
        /* Set up the address we're going to bind to. */
        name.sin_family = AF_INET;
-       name.sin_port = server_port;
+       name.sin_port = local_port;
        name.sin_addr.s_addr = INADDR_ANY;
        memset (name.sin_zero, 0, sizeof (name.sin_zero));