]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/multilink.c
config: Include some extra files in the tarball
[ppp.git] / pppd / multilink.c
index ddd848c3270bcba9c8dbeda4c6324fbc2151989d..d5423da570531fc7c9265ab9d8cf2e3cecb99c93 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * multilink.c - support routines for multilink.
  *
- * Copyright (c) 2000-2002 Paul Mackerras. All rights reserved.
+ * Copyright (c) 2000-2024 Paul Mackerras. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
- * 2. The name(s) of the authors of this software must not be used to
- *    endorse or promote products derived from this software without
- *    prior written permission.
- *
- * 3. Redistributions of any form whatsoever must retain the following
- *    acknowledgment:
- *    "This product includes software developed by Paul Mackerras
- *     <paulus@samba.org>".
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
  *
  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <unistd.h>
 
-#include "pppd.h"
+#include "pppd-private.h"
 #include "fsm.h"
 #include "lcp.h"
 #include "tdb.h"
+#include "multilink.h"
 
 bool endpoint_specified;       /* user gave explicit endpoint discriminator */
 char *bundle_id;               /* identifier for our bundle */
@@ -73,6 +75,18 @@ static int owns_unit(TDB_DATA pid, int unit);
 
 #define process_exists(n)      (kill((n), 0) == 0 || errno != ESRCH)
 
+multilink_join_hook_fn *multilink_join_hook = NULL;
+
+bool mp_master()
+{
+    return multilink_master;
+}
+
+bool mp_on()
+{
+    return doing_multilink;
+}
+
 void
 mp_check_options(void)
 {
@@ -134,12 +148,12 @@ mp_join_bundle(void)
                if (demand) {
                        /* already have a bundle */
                        cfg_bundle(0, 0, 0, 0);
-                       netif_set_mtu(0, mtu);
+                       ppp_set_mtu(0, mtu);
                        return 0;
                }
                make_new_bundle(0, 0, 0, 0);
                set_ifunit(1);
-               netif_set_mtu(0, mtu);
+               ppp_set_mtu(0, mtu);
                return 0;
        }
 
@@ -184,8 +198,8 @@ mp_join_bundle(void)
        mtu = MIN(ho->mrru, ao->mru);
        if (demand) {
                cfg_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
-               netif_set_mtu(0, mtu);
-               script_setenv("BUNDLE", bundle_id + 7, 1);
+               ppp_set_mtu(0, mtu);
+               ppp_script_setenv("BUNDLE", bundle_id + 7, 1);
                return 0;
        }
 
@@ -219,7 +233,7 @@ mp_join_bundle(void)
                /* attach to existing unit */
                if (bundle_attach(unit)) {
                        set_ifunit(0);
-                       script_setenv("BUNDLE", bundle_id + 7, 0);
+                       ppp_script_setenv("BUNDLE", bundle_id + 7, 0);
                        make_bundle_links(1);
                        unlock_db();
                        info("Link attached to %s", ifname);
@@ -231,8 +245,8 @@ mp_join_bundle(void)
        /* we have to make a new bundle */
        make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf);
        set_ifunit(1);
-       netif_set_mtu(0, mtu);
-       script_setenv("BUNDLE", bundle_id + 7, 1);
+       ppp_set_mtu(0, mtu);
+       ppp_script_setenv("BUNDLE", bundle_id + 7, 1);
        make_bundle_links(0);
        unlock_db();
        info("New bundle %s created", ifname);
@@ -268,7 +282,7 @@ void mp_bundle_terminated(void)
        print_link_stats();
        if (!demand) {
                remove_pidfiles();
-               script_unsetenv("IFNAME");
+               ppp_script_unsetenv("IFNAME");
        }
 
        lock_db();
@@ -444,7 +458,7 @@ get_default_epdisc(struct epdisc *ep)
        hp = gethostbyname(hostname);
        if (hp != NULL) {
                addr = *(u_int32_t *)hp->h_addr;
-               if (!bad_ip_adrs(addr)) {
+               if (!ppp_bad_ip_addr(addr)) {
                        addr = ntohl(addr);
                        if (!LOCAL_IP_ADDR(addr)) {
                                ep->class = EPD_IP;