Separate out PPP processing

So we can later call it on frames obtained from kernel ppp interface.

Better seen with diff -w
This commit is contained in:
Samuel Thibault 2023-04-23 15:48:02 +02:00
parent 79a08faea9
commit 1db43fc51d

View file

@ -282,6 +282,7 @@ static void processcontrol(uint8_t *buf, int len, struct sockaddr_in *addr, int
static tunnelidt new_tunnel(void); static tunnelidt new_tunnel(void);
static void unhide_value(uint8_t *value, size_t len, uint16_t type, uint8_t *vector, size_t vec_len); static void unhide_value(uint8_t *value, size_t len, uint16_t type, uint8_t *vector, size_t vec_len);
static void bundleclear(bundleidt b); static void bundleclear(bundleidt b);
static void processppp(sessionidt s, uint8_t *buf, int len, uint8_t *p, int l, struct sockaddr_in *addr, uint16_t indexudpfd);
// return internal time (10ths since process startup), set f if given // return internal time (10ths since process startup), set f if given
// as a side-effect sets time_now, and time_changed // as a side-effect sets time_now, and time_changed
@ -4179,7 +4180,15 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu
} }
} }
else else
// data
processppp(s, buf, len, p, l, addr, indexudpfd);
}
//
// process a ppp frame coming from tunnel
static void processppp(sessionidt s, uint8_t *buf, int len, uint8_t *p, int l, struct sockaddr_in *addr, uint16_t indexudpfd)
{ // data { // data
int t = session[s].tunnel;
uint16_t proto; uint16_t proto;
LOG_HEX(5, "Receive Tunnel Data", p, l); LOG_HEX(5, "Receive Tunnel Data", p, l);
@ -4354,7 +4363,6 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu
proto, ppp_state(session[s].ppp.lcp)); proto, ppp_state(session[s].ppp.lcp));
} }
} }
}
// read and process packet on tun // read and process packet on tun
// (i.e. this routine writes to buf[-8]). // (i.e. this routine writes to buf[-8]).