On Fri, Nov 26, 2021 at 01:35:14PM +0100, Krzysztof Kanas wrote:
> Hi. When remote side in sppp doesn't reply for to PPP IPCP IP-Address
> sppp will try to negotiate remote IP in endless loop. Instead use
> 10.64.64.1 + if_index as remote IP.
Why add some arbitrary RFC 1918 IP if negotiation fails? That's not
what users request or expect.
> While at it maybe it's worth to add that SPP is in RFC 1332 ?
sppp(4) STANDARDS mentions RFC 1332, if that's what you mean.
> Krzysztof Kanas
>
> Index: share/man/man4/sppp.4
> ===================================================================
> RCS file: /home/cvs//src/share/man/man4/sppp.4,v
> retrieving revision 1.26
> diff -r1.26 sppp.4
> 284,285c284,285
> < Negotiation loop avoidance is not fully implemented.
> < If the negotiation doesn't converge, this can cause an endless loop.
Please send unified diffs, i.e. use `-u' with CVS diff(1).
> ---
> > In case when remote IP can't be negotiation after 10 retries pick
> > 10.64.64.1 + if_index.
> Index: sys/net/if_sppp.h
> ===================================================================
> RCS file: /home/cvs//src/sys/net/if_sppp.h,v
> retrieving revision 1.30
> diff -r1.30 if_sppp.h
> 148a149,150
> > #define IPCP_HISADDR_COUNTER_MAX 10
> > u_int8_t hisaddr_counter; /* number of ipcp req for peer addr */
> Index: sys/net/if_spppsubr.c
> ===================================================================
> RCS file: /home/cvs//src/sys/net/if_spppsubr.c,v
> retrieving revision 1.190
> diff -r1.190 if_spppsubr.c
> 2466,2468c2466,2469
> < * XXX This can result in an endless req - nak loop if peer
> < * doesn't want to send us his address. Q: What should we do
> < * about it? XXX A: implement the max-failure counter.
> ---
> > * This can result in an endless req - nak loop if peer
> > * doesn't want to send us his address. Therefore we count
> > * the number of request if it exceeds IPCP_HISADDR_COUNTER_MAX
> > * assign remote address 10.64.64.1 + if_index.
> 2471,2479c2472,2492
> < buf[0] = IPCP_OPT_ADDRESS;
> < buf[1] = 6;
> < buf[2] = hisaddr >> 24;
> < buf[3] = hisaddr >> 16;
> < buf[4] = hisaddr >> 8;
> < buf[5] = hisaddr;
> < rlen = 6;
> < if (debug)
> < addlog("still need hisaddr ");
> ---
> > if (sp->ipcp.hisaddr_counter++ > IPCP_HISADDR_COUNTER_MAX) {
> > sp->ipcp.hisaddr_counter = 0;
> > desiredaddr = 10 << 24 | 64 << 16 | 64 << 8 | 1;
> > desiredaddr += sp->pp_if.if_index;
> > hisaddr = desiredaddr;
> > sp->ipcp.req_hisaddr = desiredaddr;
> > sp->ipcp.flags |= IPCP_HISADDR_SEEN;
> > if (debug)
> > addlog("%s guess ",
> > sppp_dotted_quad(desiredaddr));
> > } else {
> > buf[0] = IPCP_OPT_ADDRESS;
> > buf[1] = 6;
> > buf[2] = hisaddr >> 24;
> > buf[3] = hisaddr >> 16;
> > buf[4] = hisaddr >> 8;
> > buf[5] = hisaddr;
> > rlen = 6;
> > if (debug)
> > addlog("still need hisaddr ");
> > }
>