X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fmultilink.c;h=3aee0bcf6876686e73599835c483a1d585824cba;hb=09f695f09e4ff6905388e15b106cd5669b05965e;hp=7444162e66eef0dc3d43c52f78569ef013ce59cd;hpb=637346ba24c289c5a0485651c05baa3f7c22a6b8;p=ppp.git diff --git a/pppd/multilink.c b/pppd/multilink.c index 7444162..3aee0bc 100644 --- a/pppd/multilink.c +++ b/pppd/multilink.c @@ -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); @@ -204,7 +204,7 @@ mp_join_bundle() /* make sure the string is null-terminated */ rec.dptr[rec.dsize-1] = 0; /* parse the interface number */ - parse_num(rec.dptr, "IFNAME=ppp", &unit); + parse_num(rec.dptr, "UNIT=", &unit); /* check the pid value */ if (!parse_num(rec.dptr, "PPPD_PID=", &pppd_pid) || !process_exists(pppd_pid) @@ -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) @@ -417,7 +420,7 @@ owns_unit(key, unit) TDB_DATA kd, vd; int ret = 0; - slprintf(ifkey, sizeof(ifkey), "IFNAME=ppp%d", unit); + slprintf(ifkey, sizeof(ifkey), "UNIT=%d", unit); kd.dptr = ifkey; kd.dsize = strlen(ifkey); vd = tdb_fetch(pppdb, kd); @@ -586,4 +589,3 @@ str_to_epdisc(ep, str) ep->length = l; return 1; } -