Skip to content

Commit

Permalink
ppp: properly handle offered IP address
Browse files Browse the repository at this point in the history
  • Loading branch information
acassen committed Feb 7, 2024
1 parent f5fb6fc commit ca4d54a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gtp_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ sppp_cp_send(sppp_t *sp, uint16_t proto, uint8_t type,

/* PPP LCP TAG */
p = pkt->pbuff->data;
PPPOE_ADD_16(p, PPP_LCP);
PPPOE_ADD_16(p, proto);
pkt_buffer_put_data(pkt->pbuff, sizeof(uint16_t));

/* LCP header */
Expand Down Expand Up @@ -1920,8 +1920,7 @@ sppp_ipcp_RCN_nak(sppp_t *sp, lcp_hdr_t *h, int len)
* him our address then.
*/
if (len >= 6 && p[1] == 6) {
wantaddr = p[2] << 24 | p[3] << 16 |
p[4] << 8 | p[5];
wantaddr = p[2] << 24 | p[3] << 16 | p[4] << 8 | p[5];
sp->ipcp.opts |= (1 << SPPP_IPCP_OPT_ADDRESS);
if (debug & 8)
printf("[wantaddr %u.%u.%u.%u] ", NIPQUAD(wantaddr));
Expand Down Expand Up @@ -1997,6 +1996,8 @@ sppp_ipcp_scr(sppp_t *sp)
int i = 0;

if (sp->ipcp.opts & (1 << SPPP_IPCP_OPT_ADDRESS)) {
if (sp->ipcp.flags & IPCP_MYADDR_SEEN)
ouraddr = sp->ipcp.req_myaddr;
opt[i++] = IPCP_OPT_ADDRESS;
opt[i++] = 6;
opt[i++] = ouraddr >> 24;
Expand Down

0 comments on commit ca4d54a

Please sign in to comment.