Hi,

On Thu, 27 Sep 2012 13:41:52 -0400
Andrew Ngo <andrew....@gmail.com> wrote:
> Hm. I can't seem to get npppd to map users to static addresses in the
> npppd-users file, after trying various permutations of "pool-address
> ##-## <for static>" and such. The client is an iPhone running iOS 6.0,
> and is definitely able to set up a working vpn over l2tp/ipsec with
> the npppd server (many thx, btw), but the client is then always
> assigned a random address from the pool (and never the static one,
> incidentally... but that could just be chance).
> 
> Did I screw something up in the configuration or has this particular
> feature not been implemented yet? Has anyone else had troubles with
> this?

The feature was broken by the my configuration syntax change work.
Thank you for your report.  Attached diff will fix the problem.

> (By the way, the daemon goes absolutely bananas if you use a
> "framed-ip-address" on a different subnet than those in the pool.
> Bananas! I don't recommend this error. ^^)

npppd will assign ip address dynamically on that case.
Can you explain your recommendation?

Index: npppd.c
===================================================================
RCS file: /cvs/src/usr.sbin/npppd/npppd/npppd.c,v
retrieving revision 1.23
diff -u -p -r1.23 npppd.c
--- npppd.c     20 Sep 2012 20:28:09 -0000      1.23
+++ npppd.c     28 Sep 2012 07:01:14 -0000
@@ -1545,6 +1545,7 @@ npppd_assign_ip_addr(npppd *_this, npppd
                                goto dyna_assign;
                        return 1;
                }
+               ppp->assigned_pool = pool;
 
                ppp->ppp_framed_ip_address.s_addr = htonl(ip4);
                ppp->ppp_framed_ip_netmask.s_addr = htonl(ip4mask);
Index: privsep.c
===================================================================
RCS file: /cvs/src/usr.sbin/npppd/npppd/privsep.c,v
retrieving revision 1.6
diff -u -p -r1.6 privsep.c
--- privsep.c   18 Sep 2012 13:14:08 -0000      1.6
+++ privsep.c   28 Sep 2012 07:01:14 -0000
@@ -447,6 +447,9 @@ priv_get_user_info(const char *path, con
        n = strlcpy(cp, r.calling_number, sz);
        cp += ++n; sz -= n;
 
+       u->framed_ip_address = r.framed_ip_address;
+       u->framed_ip_netmask = r.framed_ip_netmask;
+
        *puser = u;
 
        return 0;
@@ -731,6 +734,8 @@ privsep_priv_on_sockio(int sock, short e
 
                        a = (struct PRIVSEP_GET_USER_INFO_ARG *)rbuf;
                        memset(&r, 0, sizeof(r));
+                       r.framed_ip_address.s_addr = INADDR_NAS_SELECT;
+                       r.framed_ip_netmask.s_addr = INADDR_NONE;
                        db[0] = a->path;
 
                        if (privsep_npppd_check_get_user_info(a)) {

Reply via email to