]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/multilink.c
pppoe: Remove the use of cdefs
[ppp.git] / pppd / multilink.c
index 7444162e66eef0dc3d43c52f78569ef013ce59cd..c49c4465ced8f1b65d3be54c35b71c000c0ac33b 100644 (file)
@@ -193,7 +193,7 @@ mp_join_bundle()
         * Check if the bundle ID is already in the database.
         */
        unit = -1;
-       tdb_writelock(pppdb);
+       lock_db();
        key.dptr = bundle_id;
        key.dsize = p - bundle_id;
        pid = tdb_fetch(pppdb, key);
@@ -221,7 +221,7 @@ mp_join_bundle()
                        set_ifunit(0);
                        script_setenv("BUNDLE", bundle_id + 7, 0);
                        make_bundle_links(1);
-                       tdb_writeunlock(pppdb);
+                       unlock_db();
                        info("Link attached to %s", ifname);
                        return 1;
                }
@@ -234,7 +234,7 @@ mp_join_bundle()
        netif_set_mtu(0, mtu);
        script_setenv("BUNDLE", bundle_id + 7, 1);
        make_bundle_links(0);
-       tdb_writeunlock(pppdb);
+       unlock_db();
        info("New bundle %s created", ifname);
        multilink_master = 1;
        return 0;
@@ -242,9 +242,9 @@ mp_join_bundle()
 
 void mp_exit_bundle()
 {
-       tdb_writelock(pppdb);
+       lock_db();
        remove_bundle_link();
-       tdb_writeunlock(pppdb);
+       unlock_db();
 }
 
 static void sendhup(char *str)
@@ -271,15 +271,18 @@ void mp_bundle_terminated()
                script_unsetenv("IFNAME");
        }
 
-       tdb_writelock(pppdb);
+       lock_db();
        destroy_bundle();
        iterate_bundle_links(sendhup);
        key.dptr = blinks_id;
        key.dsize = strlen(blinks_id);
        tdb_delete(pppdb, key);
-       tdb_writeunlock(pppdb);
-       
-new_phase(PHASE_DEAD);
+       unlock_db();
+
+       new_phase(PHASE_DEAD);
+
+       doing_multilink = 0;
+       multilink_master = 0;
 }
 
 static void make_bundle_links(int append)
@@ -442,9 +445,13 @@ get_default_epdisc(ep)
        if (p != 0 && get_if_hwaddr(ep->value, p) >= 0) {
                ep->class = EPD_MAC;
                ep->length = 6;
+               free(p);
                return 1;
        }
 
+       if (p)
+               free(p);
+
        /* see if our hostname corresponds to a reasonable IP address */
        hp = gethostbyname(hostname);
        if (hp != NULL) {