minor: coding style fixes

This commit is contained in:
goldsimon 2016-07-05 07:36:51 +02:00
parent cb5f7859fd
commit 14ca418ac0
21 changed files with 155 additions and 160 deletions

View File

@ -207,7 +207,7 @@ int main(int argc, char *argv[])
printf(" extended by Simon Goldschmidt - 2009 " NEWLINE NEWLINE);
strcpy(path, "fs");
for(i = 1; i < argc; i++) {
for (i = 1; i < argc; i++) {
if (argv[i] == NULL) {
continue;
}
@ -264,7 +264,7 @@ int main(int argc, char *argv[])
}
}
if(!check_path(path, sizeof(path))) {
if (!check_path(path, sizeof(path))) {
printf("Invalid path: \"%s\"." NEWLINE, path);
exit(-1);
}
@ -403,8 +403,7 @@ static void copy_file(const char *filename_in, FILE *fout)
exit(-1);
}
buf = malloc(COPY_BUFSIZE);
while((len = fread(buf, 1, COPY_BUFSIZE, fin)) > 0)
{
while ((len = fread(buf, 1, COPY_BUFSIZE, fin)) > 0) {
fwrite(buf, 1, len, fout);
}
free(buf);
@ -493,8 +492,7 @@ u8_t* get_file_data(const char* filename, int* file_size, int can_be_compressed,
}
fseek(inFile, 0, SEEK_END);
rs = ftell(inFile);
if(rs < 0)
{
if (rs < 0) {
printf("ftell failed with %d\n", errno);
exit(-1);
}
@ -643,8 +641,7 @@ static int is_valid_char_for_c_var(char x)
if (((x >= 'A') && (x <= 'Z')) ||
((x >= 'a') && (x <= 'z')) ||
((x >= '0') && (x <= '9')) ||
(x == '_'))
{
(x == '_')) {
return 1;
}
return 0;
@ -870,13 +867,13 @@ int file_write_http_header(FILE *data_file, const char *filename, int file_size,
file_ext++;
}
}
if((file_ext == NULL) || (*file_ext == 0)) {
if ((file_ext == NULL) || (*file_ext == 0)) {
printf("failed to get extension for file \"%s\", using default.\n", filename);
file_type = HTTP_HDR_DEFAULT_TYPE;
} else {
file_type = NULL;
for(j = 0; j < NUM_HTTP_HEADERS; j++) {
if(!strcmp(file_ext, g_psHTTPHeaders[j].extension)) {
for (j = 0; j < NUM_HTTP_HEADERS; j++) {
if (!strcmp(file_ext, g_psHTTPHeaders[j].extension)) {
file_type = g_psHTTPHeaders[j].content_type;
break;
}
@ -921,14 +918,12 @@ int file_write_http_header(FILE *data_file, const char *filename, int file_size,
memset(&stat_data, 0, sizeof(stat_data));
cur_string = modbuf;
strcpy(modbuf, "Last-Modified: ");
if(stat(filename, &stat_data) != 0)
{
if (stat(filename, &stat_data) != 0) {
printf("stat(%s) failed with error %d\n", filename, errno);
exit(-1);
}
t = gmtime(&stat_data.st_mtime);
if(t == NULL)
{
if (t == NULL) {
printf("gmtime() failed with error %d\n", errno);
exit(-1);
}
@ -1011,7 +1006,7 @@ int file_write_http_header(FILE *data_file, const char *filename, int file_size,
int file_put_ascii(FILE *file, const char* ascii_string, int len, int *i)
{
int x;
for(x = 0; x < len; x++) {
for (x = 0; x < len; x++) {
unsigned char cur = ascii_string[x];
fprintf(file, "0x%02.2x,", cur);
if ((++(*i) % HEX_BYTES_PER_LINE) == 0) {
@ -1025,7 +1020,7 @@ int s_put_ascii(char *buf, const char *ascii_string, int len, int *i)
{
int x;
int idx = 0;
for(x = 0; x < len; x++) {
for (x = 0; x < len; x++) {
unsigned char cur = ascii_string[x];
sprintf(&buf[idx], "0x%02.2x,", cur);
idx += 5;

View File

@ -458,7 +458,7 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
}
}
conn->bytes_transferred += sizeof(lwiperf_settings_t);
if(conn->bytes_transferred <= 24) {
if (conn->bytes_transferred <= 24) {
conn->time_started = sys_now();
tcp_recved(tpcb, p->tot_len);
pbuf_free(p);
@ -589,7 +589,7 @@ lwiperf_start_tcp_server(const ip_addr_t* local_addr, u16_t local_port,
struct tcp_pcb* pcb;
lwiperf_state_tcp_t* s;
if(local_addr == NULL) {
if (local_addr == NULL) {
return NULL;
}

View File

@ -331,7 +331,7 @@ netbiosns_set_name(const char* hostname)
{
size_t copy_len = strlen(hostname);
LWIP_ASSERT("NetBIOS name is too long!", copy_len < NETBIOS_NAME_LEN);
if(copy_len >= NETBIOS_NAME_LEN) {
if (copy_len >= NETBIOS_NAME_LEN) {
copy_len = NETBIOS_NAME_LEN - 1;
}
memcpy(netbiosns_local_name, hostname, copy_len + 1);

View File

@ -126,10 +126,10 @@ const struct snmp_obj_id* snmp_get_device_enterprise_oid(void)
u8_t
snmp_oid_to_ip4(const u32_t *oid, ip4_addr_t *ip)
{
if((oid[0] > 0xFF) ||
(oid[1] > 0xFF) ||
(oid[2] > 0xFF) ||
(oid[3] > 0xFF)) {
if ((oid[0] > 0xFF) ||
(oid[1] > 0xFF) ||
(oid[2] > 0xFF) ||
(oid[3] > 0xFF)) {
ip4_addr_copy(*ip, *IP4_ADDR_ANY);
return 0;
}
@ -162,22 +162,22 @@ snmp_ip4_to_oid(const ip4_addr_t *ip, u32_t *oid)
u8_t
snmp_oid_to_ip6(const u32_t *oid, ip6_addr_t *ip)
{
if((oid[0] > 0xFF) ||
(oid[1] > 0xFF) ||
(oid[2] > 0xFF) ||
(oid[3] > 0xFF) ||
(oid[4] > 0xFF) ||
(oid[5] > 0xFF) ||
(oid[6] > 0xFF) ||
(oid[7] > 0xFF) ||
(oid[8] > 0xFF) ||
(oid[9] > 0xFF) ||
(oid[10] > 0xFF) ||
(oid[11] > 0xFF) ||
(oid[12] > 0xFF) ||
(oid[13] > 0xFF) ||
(oid[14] > 0xFF) ||
(oid[15] > 0xFF)) {
if ((oid[0] > 0xFF) ||
(oid[1] > 0xFF) ||
(oid[2] > 0xFF) ||
(oid[3] > 0xFF) ||
(oid[4] > 0xFF) ||
(oid[5] > 0xFF) ||
(oid[6] > 0xFF) ||
(oid[7] > 0xFF) ||
(oid[8] > 0xFF) ||
(oid[9] > 0xFF) ||
(oid[10] > 0xFF) ||
(oid[11] > 0xFF) ||
(oid[12] > 0xFF) ||
(oid[13] > 0xFF) ||
(oid[14] > 0xFF) ||
(oid[15] > 0xFF)) {
ip6_addr_set_any(ip);
return 0;
}
@ -245,11 +245,11 @@ snmp_ip_port_to_oid(const ip_addr_t *ip, u16_t port, u32_t *oid)
u8_t
snmp_ip_to_oid(const ip_addr_t *ip, u32_t *oid)
{
if(IP_IS_ANY_TYPE_VAL(*ip)) {
if (IP_IS_ANY_TYPE_VAL(*ip)) {
oid[0] = 0; /* any */
oid[1] = 0; /* no IP OIDs follow */
return 2;
} else if(IP_IS_V6(ip)) {
} else if (IP_IS_V6(ip)) {
#if LWIP_IPV6
oid[0] = 2; /* ipv6 */
oid[1] = 16; /* 16 InetAddressIPv6 OIDs follow */
@ -281,16 +281,16 @@ u8_t
snmp_oid_to_ip(const u32_t *oid, u8_t oid_len, ip_addr_t *ip)
{
/* InetAddressType */
if(oid_len < 1) {
if (oid_len < 1) {
return 0;
}
if (oid[0] == 0) { /* any */
/* 1x InetAddressType, 1x OID len */
if(oid_len < 2) {
if (oid_len < 2) {
return 0;
}
if(oid[1] != 0) {
if (oid[1] != 0) {
return 0;
}
@ -301,17 +301,17 @@ snmp_oid_to_ip(const u32_t *oid, u8_t oid_len, ip_addr_t *ip)
} else if (oid[0] == 1) { /* ipv4 */
#if LWIP_IPV4
/* 1x InetAddressType, 1x OID len, 4x InetAddressIPv4 */
if(oid_len < 6) {
if (oid_len < 6) {
return 0;
}
/* 4x ipv4 OID */
if(oid[1] != 4) {
if (oid[1] != 4) {
return 0;
}
IP_SET_TYPE(ip, IPADDR_TYPE_V4);
if(!snmp_oid_to_ip4(&oid[2], ip_2_ip4(ip))) {
if (!snmp_oid_to_ip4(&oid[2], ip_2_ip4(ip))) {
return 0;
}
@ -319,20 +319,20 @@ snmp_oid_to_ip(const u32_t *oid, u8_t oid_len, ip_addr_t *ip)
#else /* LWIP_IPV4 */
return 0;
#endif /* LWIP_IPV4 */
} else if(oid[0] == 2) { /* ipv6 */
} else if (oid[0] == 2) { /* ipv6 */
#if LWIP_IPV6
/* 1x InetAddressType, 1x OID len, 16x InetAddressIPv6 */
if(oid_len < 18) {
if (oid_len < 18) {
return 0;
}
/* 16x ipv6 OID */
if(oid[1] != 16) {
if (oid[1] != 16) {
return 0;
}
IP_SET_TYPE(ip, IPADDR_TYPE_V6);
if(!snmp_oid_to_ip6(&oid[2], ip_2_ip6(ip))) {
if (!snmp_oid_to_ip6(&oid[2], ip_2_ip6(ip))) {
return 0;
}
@ -360,15 +360,15 @@ snmp_oid_to_ip_port(const u32_t *oid, u8_t oid_len, ip_addr_t *ip, u16_t *port)
/* InetAddressType + InetAddress */
idx += snmp_oid_to_ip(&oid[idx], oid_len-idx, ip);
if(idx == 0) {
if (idx == 0) {
return 0;
}
/* InetPortNumber */
if(oid_len < (idx+1)) {
if (oid_len < (idx+1)) {
return 0;
}
if(oid[idx] > 0xffff) {
if (oid[idx] > 0xffff) {
return 0;
}
*port = (u16_t)oid[idx];
@ -446,7 +446,7 @@ snmp_oid_append(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len)
{
LWIP_ASSERT("offset + oid_len <= LWIP_SNMP_OBJ_ID_LEN", (target->len + oid_len) <= SNMP_MAX_OBJ_ID_LEN);
if(oid_len > 0) {
if (oid_len > 0) {
MEMCPY(&target->id[target->len], oid, oid_len * sizeof(u32_t));
target->len += oid_len;
}
@ -521,7 +521,7 @@ netif_to_num(const struct netif *netif)
while (netif_iterator != NULL) {
result++;
if(netif_iterator == netif) {
if (netif_iterator == netif) {
return result;
}
@ -647,11 +647,11 @@ snmp_get_node_instance_from_oid(const u32_t *oid, u8_t oid_len, struct snmp_node
node_instance);
#ifdef LWIP_DEBUG
if(result == SNMP_ERR_NOERROR) {
if(((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_READ) != 0) && (node_instance->get_value == NULL)) {
if (result == SNMP_ERR_NOERROR) {
if (((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_READ) != 0) && (node_instance->get_value == NULL)) {
LWIP_DEBUGF(SNMP_DEBUG, ("SNMP inconsistent access: node is readable but no get_value function is specified\n"));
}
if(((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_WRITE) != 0) && (node_instance->set_value == NULL)) {
if (((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_WRITE) != 0) && (node_instance->set_value == NULL)) {
LWIP_DEBUGF(SNMP_DEBUG, ("SNMP inconsistent access: node is writable but no set_value and/or set_test function is specified\n"));
}
}
@ -722,10 +722,10 @@ snmp_get_next_node_instance_from_oid(const u32_t *oid, u8_t oid_len, snmp_valida
if (result == SNMP_ERR_NOERROR) {
#ifdef LWIP_DEBUG
if(((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_READ) != 0) && (node_instance->get_value == NULL)) {
if (((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_READ) != 0) && (node_instance->get_value == NULL)) {
LWIP_DEBUGF(SNMP_DEBUG, ("SNMP inconsistent access: node is readable but no get_value function is specified\n"));
}
if(((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_WRITE) != 0) && (node_instance->set_value == NULL)) {
if (((node_instance->access & SNMP_NODE_INSTANCE_ACCESS_WRITE) != 0) && (node_instance->set_value == NULL)) {
LWIP_DEBUGF(SNMP_DEBUG, ("SNMP inconsistent access: node is writable but no set_value function is specified\n"));
}
#endif
@ -1031,11 +1031,11 @@ snmp_oid_in_range(const u32_t *oid_in, u8_t oid_len, const struct snmp_oid_range
{
u8_t i;
if(oid_len != oid_ranges_len) {
if (oid_len != oid_ranges_len) {
return 0;
}
for(i = 0; i < oid_ranges_len; i++) {
for (i = 0; i < oid_ranges_len; i++) {
if ((oid_in[i] < oid_ranges[i].min) || (oid_in[i] > oid_ranges[i].max)) {
return 0;
}

View File

@ -101,7 +101,7 @@ interfaces_Table_get_cell_instance(const u32_t* column, const u32_t* row_oid, u8
LWIP_UNUSED_ARG(column);
/* check if incoming OID length and if values are in plausible range */
if(!snmp_oid_in_range(row_oid, row_oid_len, interfaces_Table_oid_ranges, LWIP_ARRAYSIZE(interfaces_Table_oid_ranges))) {
if (!snmp_oid_in_range(row_oid, row_oid_len, interfaces_Table_oid_ranges, LWIP_ARRAYSIZE(interfaces_Table_oid_ranges))) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -111,7 +111,7 @@ interfaces_Table_get_cell_instance(const u32_t* column, const u32_t* row_oid, u8
/* find netif with index */
netif = netif_list;
while (netif != NULL) {
if(netif_to_num(netif) == ifIndex) {
if (netif_to_num(netif) == ifIndex) {
/* store netif pointer for subsequent operations (get/test/set) */
cell_instance->reference.ptr = netif;
return SNMP_ERR_NOERROR;
@ -148,7 +148,7 @@ interfaces_Table_get_next_cell_instance(const u32_t* column, struct snmp_obj_id*
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* store netif pointer for subsequent operations (get/test/set) */
cell_instance->reference.ptr = /* (struct netif*) */state.reference;

View File

@ -254,7 +254,7 @@ ip_AddrTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row_
struct netif *netif;
/* check if incoming OID length and if values are in plausible range */
if(!snmp_oid_in_range(row_oid, row_oid_len, ip_AddrTable_oid_ranges, LWIP_ARRAYSIZE(ip_AddrTable_oid_ranges))) {
if (!snmp_oid_in_range(row_oid, row_oid_len, ip_AddrTable_oid_ranges, LWIP_ARRAYSIZE(ip_AddrTable_oid_ranges))) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -264,7 +264,7 @@ ip_AddrTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row_
/* find netif with requested ip */
netif = netif_list;
while (netif != NULL) {
if(ip4_addr_cmp(&ip, netif_ip4_addr(netif))) {
if (ip4_addr_cmp(&ip, netif_ip4_addr(netif))) {
/* fill in object properties */
return ip_AddrTable_get_cell_value_core(netif, column, value, value_len);
}
@ -299,7 +299,7 @@ ip_AddrTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_o
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return ip_AddrTable_get_cell_value_core((struct netif*)state.reference, column, value, value_len);
@ -405,7 +405,7 @@ ip_RouteTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row
struct netif *netif;
/* check if incoming OID length and if values are in plausible range */
if(!snmp_oid_in_range(row_oid, row_oid_len, ip_RouteTable_oid_ranges, LWIP_ARRAYSIZE(ip_RouteTable_oid_ranges))) {
if (!snmp_oid_in_range(row_oid, row_oid_len, ip_RouteTable_oid_ranges, LWIP_ARRAYSIZE(ip_RouteTable_oid_ranges))) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -413,7 +413,7 @@ ip_RouteTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row
snmp_oid_to_ip4(&row_oid[0], &test_ip); /* we know it succeeds because of oid_in_range check above */
/* default route is on default netif */
if(ip4_addr_isany_val(test_ip) && (netif_default != NULL)) {
if (ip4_addr_isany_val(test_ip) && (netif_default != NULL)) {
/* fill in object properties */
return ip_RouteTable_get_cell_value_core(netif_default, 1, column, value, value_len);
}
@ -424,7 +424,7 @@ ip_RouteTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row
ip4_addr_t dst;
ip4_addr_get_network(&dst, netif_ip4_addr(netif), netif_ip4_netmask(netif));
if(ip4_addr_cmp(&dst, &test_ip)) {
if (ip4_addr_cmp(&dst, &test_ip)) {
/* fill in object properties */
return ip_RouteTable_get_cell_value_core(netif, 0, column, value, value_len);
}
@ -448,7 +448,7 @@ ip_RouteTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_
snmp_next_oid_init(&state, row_oid->id, row_oid->len, result_temp, LWIP_ARRAYSIZE(ip_RouteTable_oid_ranges));
/* check default route */
if(netif_default != NULL) {
if (netif_default != NULL) {
snmp_ip4_to_oid(IP4_ADDR_ANY, &test_oid[0]);
snmp_next_oid_check(&state, test_oid, LWIP_ARRAYSIZE(ip_RouteTable_oid_ranges), netif_default);
}
@ -469,7 +469,7 @@ ip_RouteTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
ip4_addr_t dst;
snmp_oid_to_ip4(&result_temp[0], &dst);
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
@ -531,7 +531,7 @@ ip_NetToMediaTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_
u8_t i;
/* check if incoming OID length and if values are in plausible range */
if(!snmp_oid_in_range(row_oid, row_oid_len, ip_NetToMediaTable_oid_ranges, LWIP_ARRAYSIZE(ip_NetToMediaTable_oid_ranges))) {
if (!snmp_oid_in_range(row_oid, row_oid_len, ip_NetToMediaTable_oid_ranges, LWIP_ARRAYSIZE(ip_NetToMediaTable_oid_ranges))) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -545,8 +545,8 @@ ip_NetToMediaTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_
struct netif *netif;
struct eth_addr *ethaddr;
if(etharp_get_entry(i, &ip, &netif, &ethaddr)) {
if((netif_index == netif_to_num(netif)) && ip4_addr_cmp(&ip_in, ip)) {
if (etharp_get_entry(i, &ip, &netif, &ethaddr)) {
if ((netif_index == netif_to_num(netif)) && ip4_addr_cmp(&ip_in, ip)) {
/* fill in object properties */
return ip_NetToMediaTable_get_cell_value_core(i, column, value, value_len);
}
@ -573,7 +573,7 @@ ip_NetToMediaTable_get_next_cell_instance_and_value(const u32_t* column, struct
struct netif *netif;
struct eth_addr *ethaddr;
if(etharp_get_entry(i, &ip, &netif, &ethaddr)) {
if (etharp_get_entry(i, &ip, &netif, &ethaddr)) {
u32_t test_oid[LWIP_ARRAYSIZE(ip_NetToMediaTable_oid_ranges)];
test_oid[0] = netif_to_num(netif);
@ -585,7 +585,7 @@ ip_NetToMediaTable_get_next_cell_instance_and_value(const u32_t* column, struct
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return ip_NetToMediaTable_get_cell_value_core((u8_t)(size_t)state.reference, column, value, value_len);

View File

@ -171,14 +171,14 @@ tcp_ConnTable_get_cell_value_core(struct tcp_pcb *pcb, const u32_t* column, unio
value->u32 = pcb->local_port;
break;
case 4: /* tcpConnRemAddress */
if(pcb->state == LISTEN) {
if (pcb->state == LISTEN) {
value->u32 = IP4_ADDR_ANY->addr;
} else {
value->u32 = ip_2_ip4(&pcb->remote_ip)->addr;
}
break;
case 5: /* tcpConnRemPort */
if(pcb->state == LISTEN) {
if (pcb->state == LISTEN) {
value->u32 = 0;
} else {
value->u32 = pcb->remote_port;
@ -203,7 +203,7 @@ tcp_ConnTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row
struct tcp_pcb *pcb;
/* check if incoming OID length and if values are in plausible range */
if(!snmp_oid_in_range(row_oid, row_oid_len, tcp_ConnTable_oid_ranges, LWIP_ARRAYSIZE(tcp_ConnTable_oid_ranges))) {
if (!snmp_oid_in_range(row_oid, row_oid_len, tcp_ConnTable_oid_ranges, LWIP_ARRAYSIZE(tcp_ConnTable_oid_ranges))) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -219,17 +219,17 @@ tcp_ConnTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row
while (pcb != NULL) {
/* do local IP and local port match? */
if(IP_IS_V4_VAL(pcb->local_ip) &&
if (IP_IS_V4_VAL(pcb->local_ip) &&
ip4_addr_cmp(&local_ip, ip_2_ip4(&pcb->local_ip)) && (local_port == pcb->local_port)) {
/* PCBs in state LISTEN are not connected and have no remote_ip or remote_port */
if(pcb->state == LISTEN) {
if(ip4_addr_cmp(&remote_ip, IP4_ADDR_ANY) && (remote_port == 0)) {
if (pcb->state == LISTEN) {
if (ip4_addr_cmp(&remote_ip, IP4_ADDR_ANY) && (remote_port == 0)) {
/* fill in object properties */
return tcp_ConnTable_get_cell_value_core(pcb, column, value, value_len);
}
} else {
if(IP_IS_V4_VAL(pcb->remote_ip) &&
if (IP_IS_V4_VAL(pcb->remote_ip) &&
ip4_addr_cmp(&remote_ip, ip_2_ip4(&pcb->remote_ip)) && (remote_port == pcb->remote_port)) {
/* fill in object properties */
return tcp_ConnTable_get_cell_value_core(pcb, column, value, value_len);
@ -262,16 +262,16 @@ tcp_ConnTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_
while (pcb != NULL) {
u32_t test_oid[LWIP_ARRAYSIZE(tcp_ConnTable_oid_ranges)];
if(IP_IS_V4_VAL(pcb->local_ip)) {
if (IP_IS_V4_VAL(pcb->local_ip)) {
snmp_ip4_to_oid(ip_2_ip4(&pcb->local_ip), &test_oid[0]);
test_oid[4] = pcb->local_port;
/* PCBs in state LISTEN are not connected and have no remote_ip or remote_port */
if(pcb->state == LISTEN) {
if (pcb->state == LISTEN) {
snmp_ip4_to_oid(IP4_ADDR_ANY, &test_oid[5]);
test_oid[9] = 0;
} else {
if(IP_IS_V6_VAL(pcb->remote_ip)) { /* should never happen */
if (IP_IS_V6_VAL(pcb->remote_ip)) { /* should never happen */
continue;
}
snmp_ip4_to_oid(ip_2_ip4(&pcb->remote_ip), &test_oid[5]);
@ -287,7 +287,7 @@ tcp_ConnTable_get_next_cell_instance_and_value(const u32_t* column, struct snmp_
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return tcp_ConnTable_get_cell_value_core((struct tcp_pcb*)state.reference, column, value, value_len);
@ -333,13 +333,13 @@ tcp_ConnectionTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8
/* tcpConnectionLocalAddressType + tcpConnectionLocalAddress + tcpConnectionLocalPort */
idx += snmp_oid_to_ip_port(&row_oid[idx], row_oid_len-idx, &local_ip, &local_port);
if(idx == 0) {
if (idx == 0) {
return SNMP_ERR_NOSUCHINSTANCE;
}
/* tcpConnectionRemAddressType + tcpConnectionRemAddress + tcpConnectionRemPort */
idx += snmp_oid_to_ip_port(&row_oid[idx], row_oid_len-idx, &remote_ip, &remote_port);
if(idx == 0) {
if (idx == 0) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -348,7 +348,7 @@ tcp_ConnectionTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8
pcb = *tcp_pcb_nonlisten_lists[i];
while (pcb != NULL) {
if(ip_addr_cmp(&local_ip, &pcb->local_ip) &&
if (ip_addr_cmp(&local_ip, &pcb->local_ip) &&
(local_port == pcb->local_port) &&
ip_addr_cmp(&remote_ip, &pcb->remote_ip) &&
(remote_port == pcb->remote_port)) {
@ -401,7 +401,7 @@ tcp_ConnectionTable_get_next_cell_instance_and_value(const u32_t* column, struct
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return tcp_ConnectionTable_get_cell_value_core(column, (struct tcp_pcb*)state.reference, value);
@ -440,14 +440,14 @@ tcp_ListenerTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t
/* tcpListenerLocalAddressType + tcpListenerLocalAddress + tcpListenerLocalPort */
idx += snmp_oid_to_ip_port(&row_oid[idx], row_oid_len-idx, &local_ip, &local_port);
if(idx == 0) {
if (idx == 0) {
return SNMP_ERR_NOSUCHINSTANCE;
}
/* find tcp_pcb with requested ip and port*/
pcb = tcp_listen_pcbs.listen_pcbs;
while (pcb != NULL) {
if(ip_addr_cmp(&local_ip, &pcb->local_ip) &&
if (ip_addr_cmp(&local_ip, &pcb->local_ip) &&
(local_port == pcb->local_port)) {
/* fill in object properties */
return tcp_ListenerTable_get_cell_value_core(column, value);
@ -488,7 +488,7 @@ tcp_ListenerTable_get_next_cell_instance_and_value(const u32_t* column, struct s
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return tcp_ListenerTable_get_cell_value_core(column, value);

View File

@ -118,28 +118,28 @@ udp_endpointTable_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t
/* udpEndpointLocalAddressType + udpEndpointLocalAddress + udpEndpointLocalPort */
idx += snmp_oid_to_ip_port(&row_oid[idx], row_oid_len-idx, &local_ip, &local_port);
if(idx == 0) {
if (idx == 0) {
return SNMP_ERR_NOSUCHINSTANCE;
}
/* udpEndpointRemoteAddressType + udpEndpointRemoteAddress + udpEndpointRemotePort */
idx += snmp_oid_to_ip_port(&row_oid[idx], row_oid_len-idx, &remote_ip, &remote_port);
if(idx == 0) {
if (idx == 0) {
return SNMP_ERR_NOSUCHINSTANCE;
}
/* udpEndpointInstance */
if(row_oid_len < (idx+1)) {
if (row_oid_len < (idx+1)) {
return SNMP_ERR_NOSUCHINSTANCE;
}
if(row_oid[idx] != 0) {
if (row_oid[idx] != 0) {
return SNMP_ERR_NOSUCHINSTANCE;
}
/* find udp_pcb with requested ip and port*/
pcb = udp_pcbs;
while (pcb != NULL) {
if(ip_addr_cmp(&local_ip, &pcb->local_ip) &&
if (ip_addr_cmp(&local_ip, &pcb->local_ip) &&
(local_port == pcb->local_port) &&
ip_addr_cmp(&remote_ip, &pcb->remote_ip) &&
(remote_port == pcb->remote_port)) {
@ -191,7 +191,7 @@ udp_endpointTable_get_next_cell_instance_and_value(const u32_t* column, struct s
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return udp_endpointTable_get_cell_value_core(column, value);
@ -243,7 +243,7 @@ udp_Table_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row_oid
struct udp_pcb *pcb;
/* check if incoming OID length and if values are in plausible range */
if(!snmp_oid_in_range(row_oid, row_oid_len, udp_Table_oid_ranges, LWIP_ARRAYSIZE(udp_Table_oid_ranges))) {
if (!snmp_oid_in_range(row_oid, row_oid_len, udp_Table_oid_ranges, LWIP_ARRAYSIZE(udp_Table_oid_ranges))) {
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -254,8 +254,8 @@ udp_Table_get_cell_value(const u32_t* column, const u32_t* row_oid, u8_t row_oid
/* find udp_pcb with requested ip and port*/
pcb = udp_pcbs;
while (pcb != NULL) {
if(IP_IS_V4_VAL(pcb->local_ip)) {
if(ip4_addr_cmp(&ip, ip_2_ip4(&pcb->local_ip)) && (port == pcb->local_port)) {
if (IP_IS_V4_VAL(pcb->local_ip)) {
if (ip4_addr_cmp(&ip, ip_2_ip4(&pcb->local_ip)) && (port == pcb->local_port)) {
/* fill in object properties */
return udp_Table_get_cell_value_core(pcb, column, value, value_len);
}
@ -282,7 +282,7 @@ udp_Table_get_next_cell_instance_and_value(const u32_t* column, struct snmp_obj_
while (pcb != NULL) {
u32_t test_oid[LWIP_ARRAYSIZE(udp_Table_oid_ranges)];
if(IP_IS_V4_VAL(pcb->local_ip)) {
if (IP_IS_V4_VAL(pcb->local_ip)) {
snmp_ip4_to_oid(ip_2_ip4(&pcb->local_ip), &test_oid[0]);
test_oid[4] = pcb->local_port;
@ -294,7 +294,7 @@ udp_Table_get_next_cell_instance_and_value(const u32_t* column, struct snmp_obj_
}
/* did we find a next one? */
if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
if (state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {
snmp_oid_assign(row_oid, state.next_oid, state.next_oid_len);
/* fill in object properties */
return udp_Table_get_cell_value_core((struct udp_pcb*)state.reference, column, value, value_len);

View File

@ -70,7 +70,7 @@ snmp_netconn_thread(void *arg)
snmp_receive(conn, buf->p, &buf->addr, buf->port);
}
if(buf != NULL) {
if (buf != NULL) {
netbuf_delete(buf);
}
} while(1);
@ -100,7 +100,7 @@ snmp_get_local_ip_for_dst(void* handle, const ip_addr_t *dst, ip_addr_t *result)
ip_route_get_local_ip(&conn->pcb.udp->local_ip, dst, dst_if, dst_ip);
if((dst_if != NULL) && (dst_ip != NULL)) {
if ((dst_if != NULL) && (dst_ip != NULL)) {
ip_addr_copy(*result, *dst_ip);
return 1;
} else {

View File

@ -60,7 +60,7 @@ snmp_pbuf_stream_read(struct snmp_pbuf_stream* pbuf_stream, u8_t* data)
return ERR_BUF;
}
if(pbuf_copy_partial(pbuf_stream->pbuf, data, 1, pbuf_stream->offset) == 0) {
if (pbuf_copy_partial(pbuf_stream->pbuf, data, 1, pbuf_stream->offset) == 0) {
return ERR_BUF;
}
@ -83,7 +83,7 @@ snmp_pbuf_stream_writebuf(struct snmp_pbuf_stream* pbuf_stream, const void* buf,
return ERR_BUF;
}
if(pbuf_take_at(pbuf_stream->pbuf, buf, buf_len, pbuf_stream->offset) != ERR_OK) {
if (pbuf_take_at(pbuf_stream->pbuf, buf, buf_len, pbuf_stream->offset) != ERR_OK) {
return ERR_BUF;
}

View File

@ -69,7 +69,7 @@ snmp_get_local_ip_for_dst(void* handle, const ip_addr_t *dst, ip_addr_t *result)
ip_route_get_local_ip(&udp_pcb->local_ip, dst, dst_if, dst_ip);
if((dst_if != NULL) && (dst_ip != NULL)) {
if ((dst_if != NULL) && (dst_ip != NULL)) {
ip_addr_copy(*result, *dst_ip);
return 1;
} else {

View File

@ -130,7 +130,7 @@ threadsync_release_instance(struct snmp_node_instance *instance)
{
struct threadsync_data *call_data = (struct threadsync_data*)instance->reference.ptr;
if(call_data->proxy_instance.release_instance != NULL) {
if (call_data->proxy_instance.release_instance != NULL) {
call_synced_function(call_data, threadsync_release_instance_synced);
}
}
@ -163,7 +163,7 @@ do_sync(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* ins
const struct snmp_threadsync_node *threadsync_node = (const struct snmp_threadsync_node*)(const void*)instance->node;
struct threadsync_data *call_data = &threadsync_node->instance->data;
if(threadsync_node->node.node.oid != threadsync_node->target->node.oid) {
if (threadsync_node->node.node.oid != threadsync_node->target->node.oid) {
LWIP_DEBUGF(SNMP_DEBUG, ("Sync node OID does not match target node OID"));
return SNMP_ERR_NOSUCHINSTANCE;
}
@ -180,7 +180,7 @@ do_sync(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* ins
call_data->arg2.root_oid_len = root_oid_len;
call_synced_function(call_data, fn);
if(call_data->retval.u8 == SNMP_ERR_NOERROR) {
if (call_data->retval.u8 == SNMP_ERR_NOERROR) {
instance->access = call_data->proxy_instance.access;
instance->asn1_type = call_data->proxy_instance.asn1_type;
instance->release_instance = threadsync_release_instance;

View File

@ -362,7 +362,7 @@ snmp_trap_header_sum(struct snmp_msg_trap *trap, u16_t vb_len)
snmp_asn1_enc_length_cnt(len, &lenlen);
tot_len += 1 + len + lenlen;
if(IP_IS_V6_VAL(trap->sip)) {
if (IP_IS_V6_VAL(trap->sip)) {
#if LWIP_IPV6
len = sizeof(ip_2_ip6(&trap->sip)->addr);
#endif
@ -400,19 +400,19 @@ snmp_trap_header_sum(struct snmp_msg_trap *trap, u16_t vb_len)
static void
snmp_trap_varbind_enc(struct snmp_msg_trap *trap, struct snmp_pbuf_stream *pbuf_stream, struct snmp_varbind *varbinds)
{
struct snmp_asn1_tlv tlv;
struct snmp_varbind *varbind;
struct snmp_asn1_tlv tlv;
struct snmp_varbind *varbind;
varbind = varbinds;
varbind = varbinds;
SNMP_ASN1_SET_TLV_PARAMS(tlv, SNMP_ASN1_TYPE_SEQUENCE, 0, trap->vbseqlen);
snmp_ans1_enc_tlv(pbuf_stream, &tlv);
SNMP_ASN1_SET_TLV_PARAMS(tlv, SNMP_ASN1_TYPE_SEQUENCE, 0, trap->vbseqlen);
snmp_ans1_enc_tlv(pbuf_stream, &tlv);
while(varbind != NULL) {
snmp_append_outbound_varbind(pbuf_stream, varbind);
while (varbind != NULL) {
snmp_append_outbound_varbind(pbuf_stream, varbind);
varbind = varbind->next;
}
varbind = varbind->next;
}
}
/**
@ -449,7 +449,7 @@ snmp_trap_header_enc(struct snmp_msg_trap *trap, struct snmp_pbuf_stream *pbuf_s
snmp_asn1_enc_oid(pbuf_stream, trap->enterprise->id, trap->enterprise->len);
/* IP addr */
if(IP_IS_V6_VAL(trap->sip)) {
if (IP_IS_V6_VAL(trap->sip)) {
#if LWIP_IPV6
SNMP_ASN1_SET_TLV_PARAMS(tlv, SNMP_ASN1_TYPE_IPADDR, 0, sizeof(ip_2_ip6(&trap->sip)->addr));
snmp_ans1_enc_tlv(pbuf_stream, &tlv);

View File

@ -201,13 +201,13 @@ static void dhcp_option_trailer(struct dhcp *dhcp);
static err_t
dhcp_inc_pcb_refcount(void)
{
if(dhcp_pcb_refcount == 0) {
if (dhcp_pcb_refcount == 0) {
LWIP_ASSERT("dhcp_inc_pcb_refcount(): memory leak", dhcp_pcb == NULL);
/* allocate UDP PCB */
dhcp_pcb = udp_new();
if(dhcp_pcb == NULL) {
if (dhcp_pcb == NULL) {
return ERR_MEM;
}
@ -231,7 +231,7 @@ dhcp_dec_pcb_refcount(void)
LWIP_ASSERT("dhcp_pcb_refcount(): refcount error", (dhcp_pcb_refcount > 0));
dhcp_pcb_refcount--;
if(dhcp_pcb_refcount == 0) {
if (dhcp_pcb_refcount == 0) {
udp_remove(dhcp_pcb);
dhcp_pcb = NULL;
}
@ -731,7 +731,7 @@ dhcp_start(struct netif *netif)
LWIP_ASSERT("pbuf p_out wasn't freed", dhcp->p_out == NULL);
LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL );
if(dhcp->pcb_allocated != 0) {
if (dhcp->pcb_allocated != 0) {
dhcp_dec_pcb_refcount(); /* free DHCP PCB if not needed any more */
}
/* dhcp is cleared below, no need to reset flag*/
@ -743,7 +743,7 @@ dhcp_start(struct netif *netif)
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting DHCP configuration\n"));
if(dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
if (dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
return ERR_MEM;
}
dhcp->pcb_allocated = 1;
@ -784,7 +784,7 @@ dhcp_inform(struct netif *netif)
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
if(dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
if (dhcp_inc_pcb_refcount() != ERR_OK) { /* ensure DHCP PCB is allocated */
return;
}
@ -1327,7 +1327,7 @@ dhcp_stop(struct netif *netif)
LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL);
dhcp_set_state(dhcp, DHCP_STATE_OFF);
if(dhcp->pcb_allocated != 0) {
if (dhcp->pcb_allocated != 0) {
dhcp_dec_pcb_refcount(); /* free DHCP PCB if not needed any more */
dhcp->pcb_allocated = 0;
}
@ -1645,7 +1645,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
LWIP_UNUSED_ARG(arg);
/* Caught DHCP message from netif that does not have DHCP enabled? -> not interested */
if((dhcp == NULL) || (dhcp->pcb_allocated == 0)) {
if ((dhcp == NULL) || (dhcp->pcb_allocated == 0)) {
goto free_pbuf_and_return;
}
@ -1739,7 +1739,7 @@ dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr,
}
free_pbuf_and_return:
if(dhcp != NULL) {
if (dhcp != NULL) {
dhcp->msg_in = NULL;
}
pbuf_free(p);

View File

@ -445,7 +445,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
ip_addr_copy_from_ip6(ip_data.current_iphdr_src, ip6hdr->src);
/* Don't accept virtual IPv6 mapped IPv4 addresses */
if(ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_dest)) ||
if (ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_dest)) ||
ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_src)) ) {
IP6_STATS_INC(ip6.err);
IP6_STATS_INC(ip6.drop);

View File

@ -1862,13 +1862,13 @@ nd6_cleanup_netif(struct netif * netif)
u8_t i;
s8_t router_index;
for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) {
if(prefix_list[i].netif == netif) {
if (prefix_list[i].netif == netif) {
prefix_list[i].netif = NULL;
prefix_list[i].flags = 0;
}
}
for (i = 0; i < LWIP_ND6_NUM_NEIGHBORS; i++) {
if(neighbor_cache[i].netif == netif) {
if (neighbor_cache[i].netif == netif) {
for (router_index = 0; router_index < LWIP_ND6_NUM_ROUTERS; router_index++) {
if (default_router_list[router_index].neighbor_entry == &neighbor_cache[i]) {
default_router_list[router_index].neighbor_entry = NULL;

View File

@ -324,7 +324,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
if (memp != NULL) {
MEMP_STATS_INC(used, type);
if(MEMP_STATS_GET(used, type) > MEMP_STATS_GET(max, type)) {
if (MEMP_STATS_GET(used, type) > MEMP_STATS_GET(max, type)) {
MEMP_STATS_AVAIL(max, type, MEMP_STATS_GET(used, type));
}
} else {

View File

@ -64,9 +64,9 @@ raw_input_match(struct raw_pcb *pcb, u8_t broadcast)
#if LWIP_IPV4 && LWIP_IPV6
/* Dual-stack: PCBs listening to any IP type also listen to any IP address */
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
#if IP_SOF_BROADCAST_RECV
if((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
if ((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
return 0;
}
#endif /* IP_SOF_BROADCAST_RECV */
@ -75,23 +75,23 @@ raw_input_match(struct raw_pcb *pcb, u8_t broadcast)
#endif /* LWIP_IPV4 && LWIP_IPV6 */
/* Only need to check PCB if incoming IP version matches PCB IP version */
if(IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
if (IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
#if LWIP_IPV4
/* Special case: IPv4 broadcast: receive all broadcasts
* Note: broadcast variable can only be 1 if it is an IPv4 broadcast */
if(broadcast != 0) {
if (broadcast != 0) {
#if IP_SOF_BROADCAST_RECV
if(ip_get_option(pcb, SOF_BROADCAST))
if (ip_get_option(pcb, SOF_BROADCAST))
#endif /* IP_SOF_BROADCAST_RECV */
{
if(ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) {
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip))) {
return 1;
}
}
} else
#endif /* LWIP_IPV4 */
/* Handle IPv4 and IPv6: catch all or exact match */
if(ip_addr_isany(&pcb->local_ip) ||
if (ip_addr_isany(&pcb->local_ip) ||
ip_addr_cmp(&pcb->local_ip, ip_current_dest_addr())) {
return 1;
}
@ -468,7 +468,7 @@ raw_new_ip_type(u8_t type, u8_t proto)
struct raw_pcb *pcb;
pcb = raw_new(proto);
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
if (pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}

View File

@ -1591,7 +1591,7 @@ tcp_new_ip_type(u8_t type)
struct tcp_pcb * pcb;
pcb = tcp_alloc(TCP_PRIO_NORMAL);
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
if (pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}

View File

@ -1055,7 +1055,7 @@ tcp_output(struct tcp_pcb *pcb)
* either seg->next != NULL or pcb->unacked == NULL;
* RST is no sent using tcp_write/tcp_output.
*/
if((tcp_do_output_nagle(pcb) == 0) &&
if ((tcp_do_output_nagle(pcb) == 0) &&
((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)) {
break;
}

View File

@ -153,9 +153,9 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
LWIP_UNUSED_ARG(broadcast); /* in IPv6 only case */
/* Dual-stack: PCBs listening to any IP type also listen to any IP address */
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
#if LWIP_IPV4 && IP_SOF_BROADCAST_RECV
if((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
if ((broadcast != 0) && !ip_get_option(pcb, SOF_BROADCAST)) {
return 0;
}
#endif /* LWIP_IPV4 && IP_SOF_BROADCAST_RECV */
@ -163,16 +163,16 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
}
/* Only need to check PCB if incoming IP version matches PCB IP version */
if(IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
if (IP_ADDR_PCB_VERSION_MATCH_EXACT(pcb, ip_current_dest_addr())) {
#if LWIP_IPV4
/* Special case: IPv4 broadcast: all or broadcasts in my subnet
* Note: broadcast variable can only be 1 if it is an IPv4 broadcast */
if(broadcast != 0) {
if (broadcast != 0) {
#if IP_SOF_BROADCAST_RECV
if(ip_get_option(pcb, SOF_BROADCAST))
if (ip_get_option(pcb, SOF_BROADCAST))
#endif /* IP_SOF_BROADCAST_RECV */
{
if(ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) ||
if (ip4_addr_isany(ip_2_ip4(&pcb->local_ip)) ||
((ip4_current_dest_addr()->addr == IPADDR_BROADCAST)) ||
ip4_addr_netcmp(ip_2_ip4(&pcb->local_ip), ip4_current_dest_addr(), netif_ip4_netmask(inp))) {
return 1;
@ -181,7 +181,7 @@ udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
} else
#endif /* LWIP_IPV4 */
/* Handle IPv4 and IPv6: all, multicast or exact match */
if(ip_addr_isany(&pcb->local_ip) ||
if (ip_addr_isany(&pcb->local_ip) ||
#if LWIP_IPV6_MLD
(ip_current_is_v6() && ip6_addr_ismulticast(ip6_current_dest_addr())) ||
#endif /* LWIP_IPV6_MLD */
@ -1039,7 +1039,7 @@ udp_disconnect(struct udp_pcb *pcb)
{
/* reset remote address association */
#if LWIP_IPV4 && LWIP_IPV6
if(IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
if (IP_IS_ANY_TYPE_VAL(pcb->local_ip)) {
ip_addr_copy(pcb->remote_ip, *IP_ANY_TYPE);
} else {
#endif
@ -1144,7 +1144,7 @@ udp_new_ip_type(u8_t type)
struct udp_pcb *pcb;
pcb = udp_new();
#if LWIP_IPV4 && LWIP_IPV6
if(pcb != NULL) {
if (pcb != NULL) {
IP_SET_TYPE_VAL(pcb->local_ip, type);
IP_SET_TYPE_VAL(pcb->remote_ip, type);
}