X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fmultilink.c;h=c3a782f284662df0fce296d1e83518bd9a654f5f;hp=81528bb23a1a069f6965e7ca528a4168f0f35637;hb=cffe80dd87a8ba3fba8f56fda45d2c0cfd62ba4d;hpb=8e950ea70924467a81ecb8411d5fc5932ccc2f23 diff --git a/pppd/multilink.c b/pppd/multilink.c index 81528bb..c3a782f 100644 --- a/pppd/multilink.c +++ b/pppd/multilink.c @@ -49,7 +49,7 @@ static int owns_unit __P((TDB_DATA pid, int unit)); || ((addr) & 0xfff00000) == 0xac100000 /* 172.16.x.x */ \ || ((addr) & 0xffff0000) == 0xc0a80000) /* 192.168.x.x */ -#define process_exists(n) (kill(0, (n)) == 0 || errno != ESRCH) +#define process_exists(n) (kill((n), 0) == 0 || errno != ESRCH) void mp_check_options() @@ -86,8 +86,9 @@ mp_join_bundle() { lcp_options *go = &lcp_gotoptions[0]; lcp_options *ho = &lcp_hisoptions[0]; + lcp_options *ao = &lcp_allowoptions[0]; int unit, pppd_pid; - int l; + int l, mtu; char *p; TDB_DATA key, pid, rec; @@ -95,8 +96,17 @@ mp_join_bundle() /* not doing multilink */ if (go->neg_mrru) notice("oops, multilink negotiated only for receive"); - multilink = 0; + mtu = ho->neg_mru? ho->mru: PPP_MRU; + if (mtu > ao->mru) + mtu = ao->mru; + if (demand) { + /* already have a bundle */ + cfg_bundle(0, 0, 0, 0); + netif_set_mtu(0, mtu); + return 0; + } make_new_bundle(0, 0, 0, 0); + netif_set_mtu(0, mtu); set_ifunit(1); return 0; } @@ -125,14 +135,15 @@ mp_join_bundle() epdisc_to_str(&ho->endpoint)); if (bundle_name) p += slprintf(p, bundle_id+l-p, "/%v", bundle_name); - dbglog("bundle_id = %s", bundle_id+7); /* * For demand mode, we only need to configure the bundle * and attach the link. */ + 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); return 0; } @@ -175,6 +186,7 @@ mp_join_bundle() /* we have to make a new bundle */ make_new_bundle(go->mrru, ho->mrru, go->neg_ssnhf, ho->neg_ssnhf); + netif_set_mtu(0, mtu); set_ifunit(1); script_setenv("BUNDLE", bundle_id + 7, 1); tdb_writeunlock(pppdb); @@ -356,12 +368,10 @@ str_to_epdisc(ep, str) if (i == 0 || str[i] != 0) return 0; set_ip_epdisc(ep, addr); - dbglog("str_to_epdisc -> %s", epdisc_to_str(ep)); return 1; } if (i == EPD_MAC && get_if_hwaddr(ep->value, str) >= 0) { ep->length = 6; - dbglog("str_to_epdisc -> %s", epdisc_to_str(ep)); return 1; } @@ -384,7 +394,6 @@ str_to_epdisc(ep, str) if (*str != 0 || (ep->class == EPD_MAC && l != 6)) return 0; ep->length = l; - dbglog("str_to_epdisc -> %s", epdisc_to_str(ep)); return 1; }