]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Add interface deregistration routines (Brian Murrell).
authorTed Lemon <source@isc.org>
Mon, 6 Mar 2000 19:39:54 +0000 (19:39 +0000)
committerTed Lemon <source@isc.org>
Mon, 6 Mar 2000 19:39:54 +0000 (19:39 +0000)
common/bpf.c
common/dlpi.c
common/lpf.c
common/nit.c
common/raw.c
common/socket.c
common/upf.c

index 150a89471c99e66494ed14d8c9d016bc5be9f123..fd307fc28389b9378ea540e57d2ab5ae047f5694 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bpf.c,v 1.33 2000/01/26 14:55:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bpf.c,v 1.34 2000/03/06 19:39:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -130,6 +130,27 @@ void if_register_send (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_send (info)
+       struct interface_info *info;
+{
+       /* If we're using the bpf API for sending and receiving,
+          we don't need to register this interface twice. */
+#ifndef USE_BPF_RECEIVE
+       close (info -> wfdesc);
+#endif
+       info -> wfdesc = -1;
+
+       if (!quiet_interface_discovery)
+               log_info ("Disabling output on BPF/%s/%s%s%s",
+                     info -> name,
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_BPF_SEND */
 
 #if defined (USE_BPF_RECEIVE) || defined (USE_LPF_RECEIVE)
@@ -253,6 +274,23 @@ void if_register_receive (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_receive (info)
+       struct interface_info *info;
+{
+       close (info -> rfdesc);
+       info -> rfdesc = -1;
+
+       if (!quiet_interface_discovery)
+               log_info ("Disabling input on BPF/%s/%s%s%s",
+                     info -> name,
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_BPF_RECEIVE */
 
 #ifdef USE_BPF_SEND
index 26601fbf560b5c4e60fd6c99f3d1ceb16d20b83d..e4a60c646673d04a82538a6513d2c3f2661c94dc 100644 (file)
@@ -70,7 +70,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dlpi.c,v 1.17 2000/01/25 01:05:01 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dlpi.c,v 1.18 2000/03/06 19:39:53 mellon Exp $ Copyright (c) 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -357,6 +357,27 @@ void if_register_send (info)
 # endif
 #endif
 }
+
+void if_deregister_send (info)
+       struct interface_info *info;
+{
+       /* If we're using the DLPI API for sending and receiving,
+          we don't need to register this interface twice. */
+#ifndef USE_DLPI_RECEIVE
+       close (info -> wfdesc);
+#endif
+       info -> wfdesc = -1;
+
+        if (!quiet_interface_discovery)
+               log_info ("Disabling output on DLPI/%s/%s%s%s",
+                     info -> name,
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_DLPI_SEND */
 
 #ifdef USE_DLPI_RECEIVE
@@ -440,6 +461,27 @@ void if_register_receive (info)
 # endif
 #endif
 }
+
+void if_deregister_receive (info)
+       struct interface_info *info;
+{
+       /* If we're using the DLPI API for sending and receiving,
+          we don't need to register this interface twice. */
+#ifndef USE_DLPI_SEND
+       close (info -> rfdesc);
+#endif
+       info -> rfdesc = -1;
+
+        if (!quiet_interface_discovery)
+               log_info ("Disabling input on DLPI/%s/%s%s%s",
+                     info -> name,
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_DLPI_RECEIVE */
 
 #ifdef USE_DLPI_SEND
index e1a88be1ef0c064e75eac43ed409977d7f2de655..37fce8fa8c06f48bcc660c057b7ac4214afb659a 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: lpf.c,v 1.21 2000/02/15 20:40:30 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: lpf.c,v 1.22 2000/03/06 19:39:53 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -131,9 +131,9 @@ void if_deregister_send (info)
           are closed */
        close (info -> wfdesc);
 #endif
-       info -> wfdesc = 0;
+       info -> wfdesc = -1;
        if (!quiet_interface_discovery)
-               log_info ("NOT Sending on   LPF/%s/%s%s%s",
+               log_info ("Disabling output on LPF/%s/%s%s%s",
                      info -> name,
                      print_hw_addr (info -> hw_address.hbuf [0],
                                     info -> hw_address.hlen - 1,
@@ -183,9 +183,9 @@ void if_deregister_receive (info)
        /* for LPF this is simple, packet filters are removed when sockets
           are closed */
        close (info -> rfdesc);
-       info -> rfdesc = 0;
+       info -> rfdesc = -1;
        if (!quiet_interface_discovery)
-               log_info ("NOT Listening on LPF/%s/%s%s%s",
+               log_info ("Disabling input on LPF/%s/%s%s%s",
                          info -> name,
                          print_hw_addr (info -> hw_address.hbuf [0],
                                         info -> hw_address.hlen - 1,
index 0f4191bd6435b89ac6a17fb2f9c969f190fd1b46..6c28a54f8631730192260ecf863ed405b9ca6b87 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: nit.c,v 1.26 2000/01/25 01:07:41 mellon Exp $ Copyright (c) 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: nit.c,v 1.27 2000/03/06 19:39:53 mellon Exp $ Copyright (c) 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -145,6 +145,25 @@ void if_register_send (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_send (info)
+       struct interface_info *info;
+{
+       /* If we're using the nit API for sending and receiving,
+          we don't need to register this interface twice. */
+#ifndef USE_NIT_RECEIVE
+       close (info -> wfdesc);
+#endif
+       info -> wfdesc = -1;
+        if (!quiet_interface_discovery)
+               log_info ("Disabling output on NIT/%s%s%s",
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_NIT_SEND */
 
 #ifdef USE_NIT_RECEIVE
@@ -229,6 +248,24 @@ void if_register_receive (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_receive (info)
+       struct interface_info *info;
+{
+       /* If we're using the nit API for sending and receiving,
+          we don't need to register this interface twice. */
+       close (info -> rfdesc);
+       info -> rfdesc = -1;
+
+        if (!quiet_interface_discovery)
+               log_info ("Disabling input on NIT/%s%s%s",
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_NIT_RECEIVE */
 
 #ifdef USE_NIT_SEND
index fd2c063207576edfd28628f99bd8b7ff28de391b..042ad9515232443bbe8f51e6829670b7665d19e2 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: raw.c,v 1.15 1999/03/16 06:37:50 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: raw.c,v 1.16 2000/03/06 19:39:53 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -85,6 +85,20 @@ void if_register_send (info)
                       info -> shared_network -> name : ""));
 }
 
+void if_deregister_send (info)
+       struct interface_info *info;
+{
+       close (info -> wfdesc);
+       info -> wfdesc = -1;
+
+        if (!quiet_interface_discovery)
+               log_info ("Disabling output on Raw/%s%s%s",
+                     info -> name,
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
+
 size_t send_packet (interface, packet, raw, len, from, to, hto)
        struct interface_info *interface;
        struct packet *packet;
index 72a6da13c1c856495b2ca41c7110604829b3697b..1ca2d5d89a80a860ab19d0fc47c2ec779ca19fdc 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: socket.c,v 1.45 2000/02/03 03:43:51 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: socket.c,v 1.46 2000/03/06 19:39:54 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -153,6 +153,24 @@ void if_register_send (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+#if !defined (USE_SOCKET_FALLBACK)
+void if_deregister_send (info)
+       struct interface_info *info;
+{
+#ifndef USE_SOCKET_RECEIVE
+       close (info -> wfdesc);
+#endif
+       info -> wfdesc = -1;
+
+       if (!quiet_interface_discovery)
+               log_info ("Disabling output on Socket/%s%s%s",
+                     info -> name,
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
+#endif /* !USE_SOCKET_FALLBACK */
 #endif /* USE_SOCKET_SEND || USE_SOCKET_FALLBACK */
 
 #ifdef USE_SOCKET_RECEIVE
@@ -169,6 +187,19 @@ void if_register_receive (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_receive (info)
+       struct interface_info *info;
+{
+       close (info -> rfdesc);
+       info -> rfdesc = -1;
+
+       if (!quiet_interface_discovery)
+               log_info ("Disabling input on Socket/%s%s%s",
+                     info -> name,
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
 #endif /* USE_SOCKET_RECEIVE */
 
 #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_FALLBACK)
index 4988c81f2954b449b1ed34c9b572ecb6926ca875..22fd5531be15cc25e5ddb21e250a01cef26e10d9 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: upf.c,v 1.15 2000/01/25 01:17:01 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: upf.c,v 1.16 2000/03/06 19:39:54 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -132,6 +132,24 @@ void if_register_send (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_send (info)
+       struct interface_info *info;
+{
+#ifndef USE_UPF_RECEIVE
+       close (info -> wfdesc);
+#endif
+       info -> wfdesc = -1;
+        if (!quiet_interface_discovery)
+               log_info ("Disabling output on UPF/%s/%s%s%s",
+                     info -> name,
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_UPF_SEND */
 
 #ifdef USE_UPF_RECEIVE
@@ -198,6 +216,22 @@ void if_register_receive (info)
                      (info -> shared_network ?
                       info -> shared_network -> name : ""));
 }
+
+void if_deregister_receive (info)
+       struct interface_info *info;
+{
+       close (info -> rfdesc);
+       info -> rfdesc = -1;
+        if (!quiet_interface_discovery)
+               log_info ("Disabling input on UPF/%s/%s%s%s",
+                     info -> name,
+                     print_hw_addr (info -> hw_address.hbuf [0],
+                                    info -> hw_address.hlen - 1,
+                                    &info -> hw_address.hbuf [1]),
+                     (info -> shared_network ? "/" : ""),
+                     (info -> shared_network ?
+                      info -> shared_network -> name : ""));
+}
 #endif /* USE_UPF_RECEIVE */
 
 #ifdef USE_UPF_SEND