Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/ethernet/intel/eth_intel_igc.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ static int eth_intel_igc_tx_data(const struct device *dev, struct net_pkt *pkt)
/**
* @brief Identify the address family of received packets as per header type.
*/
static sa_family_t eth_intel_igc_get_sa_family(uint8_t *rx_buf)
static net_sa_family_t eth_intel_igc_get_sa_family(uint8_t *rx_buf)
{
struct net_eth_hdr *eth_hdr = (struct net_eth_hdr *)rx_buf;

Expand Down
26 changes: 13 additions & 13 deletions drivers/modem/hl7800.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@

struct hl7800_socket {
struct net_context *context;
sa_family_t family;
net_sa_family_t family;
enum net_sock_type type;
enum net_ip_protocol ip_proto;
struct net_sockaddr src;
Expand Down Expand Up @@ -418,9 +418,9 @@
struct hl7800_iface_ctx {
struct net_if *iface;
uint8_t mac_addr[6];
struct in_addr ipv4Addr, subnet, gateway, dns_v4;
struct net_in_addr ipv4Addr, subnet, gateway, dns_v4;
#ifdef CONFIG_NET_IPV6
struct in6_addr ipv6Addr, dns_v6;
struct net_in6_addr ipv6Addr, dns_v6;
char dns_v6_string[HL7800_IPV6_ADDR_LEN];
#endif
bool restarting;
Expand Down Expand Up @@ -791,7 +791,7 @@
int i;
struct hl7800_socket *sock = NULL;

for (i = 0; i < MDM_MAX_SOCKETS; i++) {

Check warning on line 794 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRF&open=AZsHtXb3YGN1O2oKtgRF&pullRequest=100748
if (!iface_ctx.sockets[i].context) {
sock = &iface_ctx.sockets[i];
break;
Expand All @@ -810,7 +810,7 @@
return NULL;
}

for (i = 0; i < MDM_MAX_SOCKETS; i++) {

Check warning on line 813 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRG&open=AZsHtXb3YGN1O2oKtgRG&pullRequest=100748
if (iface_ctx.sockets[i].socket_id == socket_id) {
sock = &iface_ctx.sockets[i];
break;
Expand Down Expand Up @@ -1454,7 +1454,7 @@
send_len = net_buf_frags_len(frag);
/* start sending data */
k_sem_reset(&sock->sock_send_sem);
if (sock->type == SOCK_STREAM) {
if (sock->type == NET_SOCK_STREAM) {
snprintk(buf, sizeof(buf), "AT+KTCPSND=%d,%zu", sock->socket_id,
send_len);
} else {
Expand Down Expand Up @@ -1504,7 +1504,7 @@
ret = -ETIMEDOUT;
}
done:
if (sock->type == SOCK_STREAM) {
if (sock->type == NET_SOCK_STREAM) {
if (sock->error == 0) {
sock->state = SOCK_CONNECTED;
}
Expand Down Expand Up @@ -2008,7 +2008,7 @@
* a01.a02.a03.a04.a05.a06.a07.a08.a09.a10.a11.a12.a13.a14.a15.a16 to
* an IPv6 address.
*/
static int hl7800_net_addr6_pton(const char *src, struct in6_addr *dst)
static int hl7800_net_addr6_pton(const char *src, struct net_in6_addr *dst)
{
int num_sections = 8;
int i, len;
Expand Down Expand Up @@ -2062,8 +2062,8 @@
size_t out_len;
char value[MDM_IP_INFO_RESP_SIZE];
char *search_start, *addr_start, *sm_start;
struct in_addr new_ipv4_addr;
struct in6_addr new_ipv6_addr;
struct net_in_addr new_ipv4_addr;
struct net_in6_addr new_ipv6_addr;
bool is_ipv4;
int addr_len;
char temp_addr_str[HL7800_IPV6_ADDR_LEN];
Expand Down Expand Up @@ -2274,7 +2274,7 @@
search_start = value;

/* find all delimiters (,) */
for (i = 0; i < num_delims; i++) {

Check warning on line 2277 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRH&open=AZsHtXb3YGN1O2oKtgRH&pullRequest=100748
delims[i] = strchr(search_start, ',');
if (!delims[i]) {
LOG_ERR("Could not find delim %d, val: %s", i, value);
Expand Down Expand Up @@ -2772,7 +2772,7 @@
memset(iface_ctx.mdm_apn.password, 0,
sizeof(iface_ctx.mdm_apn.password));

i = 0;

Check warning on line 2775 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Value stored to 'i' is never read

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRN&open=AZsHtXb3YGN1O2oKtgRN&pullRequest=100748
p = strchr(line, '"');
if (p != NULL) {
p += 1;
Expand Down Expand Up @@ -3285,7 +3285,7 @@
break;
}

start = strstr(start, "\"") + 1;

Check warning on line 3288 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Null pointer passed to 1st parameter expecting 'nonnull'

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRO&open=AZsHtXb3YGN1O2oKtgRO&pullRequest=100748
end = strstr(start, POLTE_LOC_DELIMITER);
if (start > rsp && start < rsp_end && end < rsp_end && end > start) {
memcpy(data.latitude, start, MIN(end - start, sizeof(data.latitude) - 1));
Expand Down Expand Up @@ -3338,7 +3338,7 @@
int i;
struct hl7800_socket *sock = NULL;

for (i = 0; i < MDM_MAX_SOCKETS; i++) {

Check warning on line 3341 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRI&open=AZsHtXb3YGN1O2oKtgRI&pullRequest=100748
sock = &iface_ctx.sockets[i];
if ((sock->context != NULL) && (sock->type == NET_SOCK_STREAM)) {
LOG_DBG("Sock %d closed", sock->socket_id);
Expand Down Expand Up @@ -3777,7 +3777,7 @@
search_start = value;

/* find all delimiters */
for (i = 0; i < num_delims; i++) {

Check warning on line 3780 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRJ&open=AZsHtXb3YGN1O2oKtgRJ&pullRequest=100748
delims[i] = strchr(search_start, ',');
if (!delims[i]) {
LOG_ERR("Could not find delim %d, val: %s", i,
Expand Down Expand Up @@ -4942,7 +4942,7 @@
if (!iface_ctx.vgpio_state) {
if (iface_ctx.desired_sleep_level == HL7800_SLEEP_HIBERNATE ||
iface_ctx.desired_sleep_level == HL7800_SLEEP_LITE_HIBERNATE) {
if (iface_ctx.sleep_state != iface_ctx.desired_sleep_level) {

Check warning on line 4945 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this "if" statement with the enclosing one.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRK&open=AZsHtXb3YGN1O2oKtgRK&pullRequest=100748
set_sleep_state(iface_ctx.desired_sleep_level);
}
}
Expand Down Expand Up @@ -5008,7 +5008,7 @@
int i;
struct hl7800_socket *sock = NULL;

for (i = 0; i < MDM_MAX_SOCKETS; i++) {

Check warning on line 5011 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRL&open=AZsHtXb3YGN1O2oKtgRL&pullRequest=100748
sock = &iface_ctx.sockets[i];
if ((sock->context != NULL) && (sock->created)) {
/* mark socket as possibly needing re-configuration */
Expand Down Expand Up @@ -5651,7 +5651,7 @@

#ifdef CONFIG_MODEM_HL7800_BOOT_DELAY
if (!iface_ctx.initialized) {
if (iface_ctx.iface != NULL) {

Check warning on line 5654 in drivers/modem/hl7800.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this "if" statement with the enclosing one.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsHtXb3YGN1O2oKtgRM&open=AZsHtXb3YGN1O2oKtgRM&pullRequest=100748
hl7800_build_mac(&iface_ctx);
net_if_set_link_addr(iface_ctx.iface, iface_ctx.mac_addr,
sizeof(iface_ctx.mac_addr),
Expand Down Expand Up @@ -5958,7 +5958,7 @@
return ret;
}

static int offload_get(sa_family_t family, enum net_sock_type type,
static int offload_get(net_sa_family_t family, enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
{
Expand Down Expand Up @@ -6010,7 +6010,7 @@
}

static int offload_bind(struct net_context *context,
const struct net_sockaddr *addr, socklen_t addr_len)
const struct net_sockaddr *addr, net_socklen_t addr_len)
{
struct hl7800_socket *sock = NULL;

Expand Down Expand Up @@ -6049,7 +6049,7 @@
}

static int offload_connect(struct net_context *context,
const struct net_sockaddr *addr, socklen_t addr_len,
const struct net_sockaddr *addr, net_socklen_t addr_len,
net_context_connect_cb_t cb, int32_t timeout,
void *user_data)
{
Expand Down Expand Up @@ -6136,7 +6136,7 @@
}

static int offload_sendto(struct net_pkt *pkt, const struct net_sockaddr *dst_addr,
socklen_t addr_len, net_context_send_cb_t cb,
net_socklen_t addr_len, net_context_send_cb_t cb,
int32_t timeout, void *user_data)
{
struct net_context *context = net_pkt_context(pkt);
Expand Down Expand Up @@ -6192,7 +6192,7 @@
int32_t timeout, void *user_data)
{
struct net_context *context = net_pkt_context(pkt);
socklen_t addr_len;
net_socklen_t addr_len;

addr_len = 0;

Expand Down
12 changes: 6 additions & 6 deletions drivers/modem/hl78xx/hl78xx_sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,12 @@ static int validate_socket(const struct modem_socket *sock, struct hl78xx_socket
return -1;
}

bool not_connected = (!sock->is_connected && sock->type != SOCK_DGRAM);
bool not_connected = (!sock->is_connected && sock->type != NET_SOCK_DGRAM);
bool tcp_disconnected =
(sock->type == SOCK_STREAM &&
(sock->type == NET_SOCK_STREAM &&
!socket_data->tcp_conn_status[HL78XX_TCP_STATUS_ID(sock->id)].is_connected);
bool udp_not_created =
(sock->type == SOCK_DGRAM &&
(sock->type == NET_SOCK_DGRAM &&
!socket_data->udp_conn_status[HL78XX_UDP_STATUS_ID(sock->id)].is_created);

if (not_connected || tcp_disconnected || udp_not_created) {
Expand Down Expand Up @@ -1959,15 +1959,15 @@ static int validate_and_prepare(struct modem_socket *sock, const struct net_sock
errno = EINVAL;
return -1;
}
if (sock->type != SOCK_DGRAM && !sock->is_connected) {
if (sock->type != NET_SOCK_DGRAM && !sock->is_connected) {
errno = ENOTCONN;
return -1;
}
if (!*dst_addr && sock->ip_proto == NET_IPPROTO_UDP) {
*dst_addr = &sock->dst;
}
if (*buf_len > MDM_MAX_DATA_LENGTH) {
if (sock->type == SOCK_DGRAM) {
if (sock->type == NET_SOCK_DGRAM) {
errno = EMSGSIZE;
return -1;
}
Expand Down Expand Up @@ -2137,7 +2137,7 @@ static ssize_t offload_sendto(void *obj, const void *buf, size_t len, int flags,
* destination address is provided or the socket has a stored dst. The
* helper validate_and_prepare will supply sock->dst for UDP when needed.
*/
if (sock->type != SOCK_DGRAM && !sock->is_connected) {
if (sock->type != NET_SOCK_DGRAM && !sock->is_connected) {
errno = ENOTCONN;
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/modem/modem_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern "C" {
#endif

__net_socket struct modem_socket {
sa_family_t family;
net_sa_family_t family;
enum net_sock_type type;
int ip_proto;
struct net_sockaddr src;
Expand Down
2 changes: 1 addition & 1 deletion drivers/modem/ublox-sara-r4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ static const struct socket_dns_offload offload_dns_ops = {
};
#endif

static int net_offload_dummy_get(sa_family_t family,
static int net_offload_dummy_get(net_sa_family_t family,
enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
Expand Down
4 changes: 2 additions & 2 deletions drivers/modem/wncm14a2a.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

struct wncm14a2a_socket {
struct net_context *context;
sa_family_t family;
net_sa_family_t family;
enum net_sock_type type;
enum net_ip_protocol ip_proto;
struct net_sockaddr src;
Expand Down Expand Up @@ -240,7 +240,7 @@
int i;
struct wncm14a2a_socket *sock = NULL;

for (i = 0; i < MDM_MAX_SOCKETS; i++) {

Check warning on line 243 in drivers/modem/wncm14a2a.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsDj_TcLh3lS8el5LBI&open=AZsDj_TcLh3lS8el5LBI&pullRequest=100748
if (!ictx.sockets[i].context) {
sock = &ictx.sockets[i];
break;
Expand All @@ -259,7 +259,7 @@
return NULL;
}

for (i = 0; i < MDM_MAX_SOCKETS; i++) {

Check warning on line 262 in drivers/modem/wncm14a2a.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Declare the variable "i" inside the loop.

See more on https://sonarcloud.io/project/issues?id=zephyrproject-rtos_zephyr&issues=AZsDj_TcLh3lS8el5LBJ&open=AZsDj_TcLh3lS8el5LBJ&pullRequest=100748
if (ictx.sockets[i].socket_id == socket_id) {
sock = &ictx.sockets[i];
break;
Expand Down Expand Up @@ -1430,7 +1430,7 @@

/*** OFFLOAD FUNCTIONS ***/

static int offload_get(sa_family_t family,
static int offload_get(net_sa_family_t family,
enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/esp_at/esp_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ static int esp_put(struct net_context *context)
return 0;
}

static int esp_get(sa_family_t family,
static int esp_get(net_sa_family_t family,
enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/eswifi/eswifi_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static int eswifi_off_put(struct net_context *context)
return ret;
}

static int eswifi_off_get(sa_family_t family,
static int eswifi_off_get(net_sa_family_t family,
enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/simplelink/simplelink.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static int simplelink_mgmt_disconnect(const struct device *dev)
return ret ? -EIO : ret;
}

static int simplelink_dummy_get(sa_family_t family,
static int simplelink_dummy_get(net_sa_family_t family,
enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/siwx91x/siwx91x_wifi_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static void siwx91x_sock_on_recv(sl_si91x_fdset_t *read_fd, sl_si91x_fdset_t *wr
siwx91x_sock_on_recv);
}

static int siwx91x_sock_get(sa_family_t family, enum net_sock_type type,
static int siwx91x_sock_get(net_sa_family_t family, enum net_sock_type type,
enum net_ip_protocol ip_proto, struct net_context **context)
{
struct siwx91x_dev *sidev = net_if_get_first_wifi()->if_dev->dev->data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/winc1500/wifi_winc1500.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static char *socket_message_to_string(uint8_t message)
/**
* This function is called when the socket is to be opened.
*/
static int winc1500_get(sa_family_t family,
static int winc1500_get(net_sa_family_t family,
enum net_sock_type type,
enum net_ip_protocol ip_proto,
struct net_context **context)
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/net/net_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ struct net_cmsghdr {
#if defined(CONFIG_NET_NATIVE_OFFLOADED_SOCKETS)
#define UNIX_PATH_MAX 108
#undef NET_SOCKADDR_MAX_SIZE
/* Define NET_SOCKADDR_MAX_SIZE to be struct of sa_family_t + char[UNIX_PATH_MAX] */
/* Define NET_SOCKADDR_MAX_SIZE to be struct of net_sa_family_t + char[UNIX_PATH_MAX] */
#define NET_SOCKADDR_MAX_SIZE (UNIX_PATH_MAX+sizeof(net_sa_family_t))
#if !defined(CONFIG_NET_SOCKETS_PACKET)
#undef NET_SOCKADDR_PTR_MAX_SIZE
Expand Down