diff -urN mpd-4.4.1/src/bund.c mpd/src/bund.c --- mpd-4.4.1/src/bund.c 2008-01-20 05:34:34.000000000 +0500 +++ mpd/src/bund.c 2008-06-18 12:44:24.000000000 +0600 @@ -864,6 +864,7 @@ u_char netflow_in = 0; u_char netflow_out = 0; u_char nat = 0; + u_char retain = 0; int k; /* Args */ @@ -873,7 +874,7 @@ if (ac > 0 && av[0][0] == '-') { optreset = 1; optind = 0; - while ((k = getopt(ac, av, "nNati:")) != -1) { + while ((k = getopt(ac, av, "rnNati:")) != -1) { switch (k) { case 'i': reqIface = optarg; @@ -881,6 +882,9 @@ case 't': tee = 1; break; + case 'r': + retain = 1; + break; case 'n': #ifdef USE_NG_NETFLOW netflow_in = 1; @@ -977,6 +981,8 @@ Enable(&b->iface.options, IFACE_CONF_NETFLOW_IN); if (netflow_out) Enable(&b->iface.options, IFACE_CONF_NETFLOW_OUT); + if (retain) + Enable(&b->iface.options, IFACE_CONF_RETAIN); /* Get message channel */ b->msgs = MsgRegister(BundMsg); @@ -1549,7 +1555,10 @@ char path[NG_PATHLEN + 1]; if (iface) { - snprintf(path, sizeof(path), "%s:", b->iface.ifname); + if (Enabled(&b->iface.options, IFACE_CONF_RETAIN)) + snprintf(path, sizeof(path), "%s:inet", b->iface.ifname); + else + snprintf(path, sizeof(path), "%s:", b->iface.ifname); NgFuncShutdownNode(b->csock, b->name, path); } if (ppp) { diff -urN mpd-4.4.1/src/iface.c mpd/src/iface.c --- mpd-4.4.1/src/iface.c 2007-12-21 01:34:31.000000000 +0500 +++ mpd/src/iface.c 2008-06-18 12:44:24.000000000 +0600 @@ -173,6 +173,7 @@ { 0, IFACE_CONF_NETFLOW_IN, "netflow-in" }, { 0, IFACE_CONF_NETFLOW_OUT, "netflow-out" }, { 0, IFACE_CONF_IPACCT, "ipacct" }, + { 0, IFACE_CONF_RETAIN, "retain" }, { 0, 0, NULL }, }; @@ -800,6 +801,19 @@ if (*iface->up_script) { char selfbuf[40],peerbuf[40]; char ns1buf[21], ns2buf[21]; + Link L; + char peeraddr[64]; + int l; + + /* Fill in peeraddr[] */ + + for (l=0; l < b->n_links; l++) { + L = b->links[l]; + if (L && (L->phys->state != PHYS_STATE_DOWN)) { + PhysGetPeerAddr(L->phys, peeraddr, sizeof(peeraddr)); + break; + } + } if(b->ipcp.want_dns[0].s_addr != 0) snprintf(ns1buf, sizeof(ns1buf), "dns1 %s", inet_ntoa(b->ipcp.want_dns[0])); @@ -810,10 +824,11 @@ else ns2buf[0] = '\0'; - ExecCmd(LG_IFACE2, b->name, "%s %s inet %s %s '%s' %s %s", + ExecCmd(LG_IFACE2, b->name, "%s %s inet %s %s '%s' %s %s %s", iface->up_script, iface->ifname, u_rangetoa(&iface->self_addr,selfbuf, sizeof(selfbuf)), u_addrtoa(&iface->peer_addr, peerbuf, sizeof(peerbuf)), *b->params.authname ? b->params.authname : "-", + peeraddr[0] ? peeraddr : "N/A", ns1buf, ns2buf); } diff -urN mpd-4.4.1/src/iface.h mpd/src/iface.h --- mpd-4.4.1/src/iface.h 2007-08-02 20:42:56.000000000 +0600 +++ mpd/src/iface.h 2008-06-18 12:44:24.000000000 +0600 @@ -59,6 +59,7 @@ IFACE_CONF_NETFLOW_IN, IFACE_CONF_NETFLOW_OUT, IFACE_CONF_IPACCT, + IFACE_CONF_RETAIN, }; /* Dial-on-demand packet cache */ diff -urN mpd-4.4.1/src/radius.c mpd/src/radius.c --- mpd-4.4.1/src/radius.c 2007-11-19 03:53:37.000000000 +0500 +++ mpd/src/radius.c 2008-06-18 12:43:44.000000000 +0600 @@ -358,7 +358,8 @@ Log(LG_RADIUS2, ("[%s] RADIUS: %s: Sending accounting data (Type: %d)", auth->info.lnkname, __func__, auth->acct_type)); - RadiusSendRequest(auth); + if ((RadiusSendRequest(auth) == RAD_NACK) && (auth->acct_type == AUTH_ACCT_START)) + auth->drop_user++; }