diff --git a/netutils/pppd/ahdlc.c b/netutils/pppd/ahdlc.c index 0245a6a1b..06cdb814c 100644 --- a/netutils/pppd/ahdlc.c +++ b/netutils/pppd/ahdlc.c @@ -365,12 +365,12 @@ u8_t ahdlc_tx(struct ppp_context_s *ctx, u16_t protocol, u8_t *header, #if PACKET_TX_DEBUG DEBUG1(("\n")); - for(i = 0; i < headerlen; ++i) + for (i = 0; i < headerlen; ++i) { DEBUG1(("0x%02x ", header[i])); } - for(i = 0; i < datalen; ++i) + for (i = 0; i < datalen; ++i) { DEBUG1(("0x%02x ", buffer[i])); } @@ -405,7 +405,7 @@ u8_t ahdlc_tx(struct ppp_context_s *ctx, u16_t protocol, u8_t *header, /* Write header if it exists */ - for(i = 0; i < headerlen; ++i) + for (i = 0; i < headerlen; ++i) { /* Get next byte from buffer */ @@ -418,7 +418,7 @@ u8_t ahdlc_tx(struct ppp_context_s *ctx, u16_t protocol, u8_t *header, /* Write frame bytes */ - for(i = 0; i < datalen; ++i) + for (i = 0; i < datalen; ++i) { /* Get next byte from buffer */ diff --git a/netutils/pppd/ppp.c b/netutils/pppd/ppp.c index 2851039a5..6321a6730 100644 --- a/netutils/pppd/ppp.c +++ b/netutils/pppd/ppp.c @@ -99,7 +99,7 @@ static void ppp_reject_protocol(struct ppp_context_s *ctx, u16_t protocol, dptr = buffer + count + 6; sptr = buffer + count; - for(i = 0; i < count; ++i) + for (i = 0; i < count; ++i) { *dptr-- = *sptr--; } @@ -127,7 +127,7 @@ void dump_ppp_packet(u8_t *buffer, u16_t len) int i; DEBUG1(("\n")); - for(i = 0;i < len; ++i) + for (i = 0;i < len; ++i) { if ((i & 0x1f) == 0x10) { @@ -371,41 +371,42 @@ void ppp_upcall(struct ppp_context_s *ctx, u16_t protocol, u8_t *buffer, u16_t l { /* Demux on protocol field */ - switch(protocol) { - case LCP: /* We must support some level of LCP */ - DEBUG1(("LCP Packet - ")); - lcp_rx(ctx, buffer, len); - DEBUG1(("\n")); - break; + switch (protocol) + { + case LCP: /* We must support some level of LCP */ + DEBUG1(("LCP Packet - ")); + lcp_rx(ctx, buffer, len); + DEBUG1(("\n")); + break; #ifdef CONFIG_NETUTILS_PPPD_PAP - case PAP: /* PAP should be compile in optional */ - DEBUG1(("PAP Packet - ")); - pap_rx(ctx, buffer, len); - DEBUG1(("\n")); - break; + case PAP: /* PAP should be compile in optional */ + DEBUG1(("PAP Packet - ")); + pap_rx(ctx, buffer, len); + DEBUG1(("\n")); + break; #endif /* CONFIG_NETUTILS_PPPD_PAP */ - case IPCP: /* IPCP should be compile in optional. */ - DEBUG1(("IPCP Packet - ")); - ipcp_rx(ctx, buffer, len); - DEBUG1(("\n")); - break; + case IPCP: /* IPCP should be compile in optional. */ + DEBUG1(("IPCP Packet - ")); + ipcp_rx(ctx, buffer, len); + DEBUG1(("\n")); + break; - case IPV4: /* We must support IPV4 */ - DEBUG1(("IPV4 Packet---\n")); - memcpy(ctx->ip_buf, buffer, len); - ctx->ip_len = len; - ctx->ip_no_data_time = 0; - DEBUG1(("\n")); - break; + case IPV4: /* We must support IPV4 */ + DEBUG1(("IPV4 Packet---\n")); + memcpy(ctx->ip_buf, buffer, len); + ctx->ip_len = len; + ctx->ip_no_data_time = 0; + DEBUG1(("\n")); + break; - default: - DEBUG1(("Unknown PPP Packet Type 0x%04x - ",protocol)); - ppp_reject_protocol(ctx, protocol, buffer, len); - DEBUG1(("\n")); - break; - } + default: + DEBUG1(("Unknown PPP Packet Type 0x%04x - ",protocol)); + ppp_reject_protocol(ctx, protocol, buffer, len); + DEBUG1(("\n")); + break; + } } } @@ -460,7 +461,7 @@ u16_t scan_packet(struct ppp_context_s *ctx, u16_t protocol, const u8_t *list, bad = 1; *tptr++ = i; j = *tptr++ = *bptr++; - for(i = 0; i < j - 2; ++i) + for (i = 0; i < j - 2; ++i) { *tptr++ = *bptr++; } diff --git a/netutils/pppd/pppd.c b/netutils/pppd/pppd.c index 3a51a4f45..7f2c68ffe 100644 --- a/netutils/pppd/pppd.c +++ b/netutils/pppd/pppd.c @@ -113,7 +113,9 @@ static int tun_alloc(char *dev) int fd, err; if ((fd = open("/dev/tun", O_RDWR)) < 0) + { return fd; + } printf("tun fd:%i\n", fd); @@ -151,7 +153,9 @@ static int open_tty(char *dev) int err; if ((fd = open(dev, O_RDWR)) < 0) + { return fd; + } if ((err = make_nonblock(fd)) < 0) {