]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/multilink.c
Fix authentication on second time around with multilink and persist
[ppp.git] / pppd / multilink.c
index 7444162e66eef0dc3d43c52f78569ef013ce59cd..135cab0b42ad419d1c4297240cf464ca6b83b14f 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)