ppp: don't bother with magic number
PATCH 1/1 ppp: don't bother with magic number
Commit to not supporting loop back detection. Because we never negotiate a magic number locally, we can't reliably detect it. Just accept peer's magic number option, but don't bother storing it.
--- gatchat/ppp_cp.c | 8 +++++++- gatchat/ppp_lcp.c | 6 +----- 2 files changed, 8 insertions(+), 6 deletions(-)
gatchat/ppp_cp.c +7 -1
@@ -574,7 +574,7 @@ static void pppcp_send_echo_reply(struct pppcp_data *data,*/ packet->identifier = header->identifier; -/* magic number? */ +/* magic number will always be zero */ ppp_transmit (data->ppp,pppcp_to_ppp_packet (packet),ntohs (packet->length));
@@ -855,6 +855,12 @@ static guint8 pppcp_process_protocol_reject(struct pppcp_data *data,return RXJ_MINUS ; } +/* +* For Echo-Request, Echo-Reply, and Discard-Request, we will not +* bother checking the magic number of the packet, because we will +* never send an echo or discard request. We can't reliably detect +* loop back anyway since we don't negotiate a magic number. +*/ static guint8 pppcp_process_echo_request (struct pppcp_data *data,struct pppcp_packet *packet) {
gatchat/ppp_lcp.c +1 -5
@@ -64,7 +64,6 @@ enum lcp_options {#define REQ_OPTION_ACCM 0x1struct lcp_data { -guint32 magic_number;guint8 options[MAX_CONFIG_OPTION_SIZE ];guint16 options_len;guint8 req_options;
@@ -157,7 +156,6 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,const struct pppcp_packet *packet, guint8 **new_options, guint16 *new_len) { - struct lcp_data *lcp = pppcp_get_data(pppcp); GAtPPP *ppp = pppcp_get_ppp(pppcp);struct ppp_option_iter iter;
@@ -180,7 +178,6 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,if (magic ==0 )return RCR_REJECT ; -/* TODO: Handle loopback */ break ; }default :
@@ -201,8 +198,7 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,ppp_set_auth (ppp,ppp_option_iter_get_data (&iter));break ;case MAGIC_NUMBER : - lcp->magic_number = -get_host_long (ppp_option_iter_get_data (&iter)); +/* don't care */ break ;case PFC :ppp_set_pfc (ppp, TRUE);
Signature · 1 line
1.6.6.1