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 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 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
// 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
{ // data
// 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
int t = session[s].tunnel;
uint16_t proto;
LOG_HEX(5, "Receive Tunnel Data", p, l);
@ -4353,7 +4362,6 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr, uint16_t indexu
LOG(2, s, t, "Unknown PPP protocol 0x%04X received in LCP %s state\n",
proto, ppp_state(session[s].ppp.lcp));
}
}
}
// read and process packet on tun