Skip to content

Commit

Permalink
Bump python to python3, Fedora does not include any "python" executable.
Browse files Browse the repository at this point in the history
Add grp.h for Linux/setgroups API.
Add comment based [[fallthrough]] to satisfy GCC.
  • Loading branch information
steve-o committed Jun 19, 2020
1 parent 21d1983 commit e2ff9cf
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 37 deletions.
2 changes: 1 addition & 1 deletion openpgm/pgm/SConscript.libpgm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ e.Append(CCFLAGS = '-DGETTEXT_PACKAGE=\'"pgm"\'');
e.Command ('galois_tables.c', 'galois_generator.pl', "perl $SOURCE > $TARGET");

# Version stamping
e.Command ('version.c', 'version_generator.py', "python $SOURCE > $TARGET");
e.Command ('version.c', 'version_generator.py', "python3 $SOURCE > $TARGET");
e.Depends ('version.c', src);
src += ['version.c'];

Expand Down
1 change: 1 addition & 0 deletions openpgm/pgm/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#ifndef _WIN32
# include <netdb.h>
# include <grp.h>
#endif
#include <impl/i18n.h>
#include <impl/framework.h>
Expand Down
1 change: 1 addition & 0 deletions openpgm/pgm/examples/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ receiver_routine (
pgm_getsockopt (async->sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
}
goto block;
/* fallthrough */
case PGM_IO_STATUS_RATE_LIMITED:
{
socklen_t optlen = sizeof (tv);
Expand Down
5 changes: 3 additions & 2 deletions openpgm/pgm/examples/daytime.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ main (
case 'b':
case 'B':
proactive_packets = 1;
/* fallthrough */
case 'o':
case 'O':
use_ondemand_parity = TRUE;
Expand Down Expand Up @@ -319,8 +320,8 @@ create_sock (void)
fprintf (stderr, "Parsing network parameter: %s\n", pgm_err->message);
goto err_abort;
} else {
char network[1024];
printf ("Network parameter: { %s }\n", pgm_addrinfo_to_string (res, network, sizeof (network)));
char s[1024];
printf ("Network parameter: { %s }\n", pgm_addrinfo_to_string (res, s, sizeof (s)));
}

sa_family = res->ai_send_addrs[0].gsr_group.ss_family;
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/enonblocksyncrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ main (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/enonblocksyncrecvmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ main (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/enonblocksyncrecvmsgv.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ main (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/pgmping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ receiver_thread (
break;
}
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
//g_message ("would block");
block:
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/pgmrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ receiver_thread (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
block:
#ifdef CONFIG_HAVE_EPOLL
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/pnonblocksyncrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ main (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
/* poll for next event */
block:
Expand Down
1 change: 1 addition & 0 deletions openpgm/pgm/examples/purinrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ main (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
/* select for next event */
block:
Expand Down
4 changes: 2 additions & 2 deletions openpgm/pgm/examples/shortcakerecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ on_startup (void)
fprintf (stderr, "Parsing network parameter: %s\n", pgm_err->message);
goto err_abort;
} else {
char network[1024];
printf ("Network parameter: { %s }\n", pgm_addrinfo_to_string (res, network, sizeof (network)));
char s[1024];
printf ("Network parameter: { %s }\n", pgm_addrinfo_to_string (res, s, sizeof (s)));
}

sa_family = res->ai_send_addrs[0].gsr_group.ss_family;
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/examples/snonblocksyncrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ main (
socklen_t optlen = sizeof (tv);
pgm_getsockopt (g_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
/* fall through */
/* fallthrough */
case PGM_IO_STATUS_WOULD_BLOCK:
/* select for next event */
block:
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/getnodeaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pgm_getnodeaddr (
t->ai_addrlen = ai->ai_addrlen;
t->ai_addr = (struct sockaddr*)p;
p += ai->ai_addrlen;
t->ai_next = (NULL == ai->ai_next) ? NULL : p;
t->ai_next = (NULL == ai->ai_next) ? NULL : (struct addrinfo*)p;
}
freeaddrinfo (result);
*res = na;
Expand Down
21 changes: 12 additions & 9 deletions openpgm/pgm/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#ifdef _AIX
# define IP_MULTICAST
#endif
# include <arpa/inet.h>
# include <sys/types.h>
# include <sys/socket.h>
# include <netdb.h> /* _GNU_SOURCE for EAI_NODATA */
Expand Down Expand Up @@ -162,11 +163,11 @@ pgm_gsr_to_string (
)
{
char group[1024], source[1024], addr[1024];
if (0 != pgm_sockaddr_ntop ((struct sockaddr*)&gsr->gsr_group, group, sizeof (group)))
if (0 != pgm_sockaddr_ntop ((const struct sockaddr*)&gsr->gsr_group, group, sizeof (group)))
group[0] = 0;
if (0 != pgm_sockaddr_ntop ((struct sockaddr*)&gsr->gsr_source, source, sizeof (source)))
if (0 != pgm_sockaddr_ntop ((const struct sockaddr*)&gsr->gsr_source, source, sizeof (source)))
source[0] = 0;
if (0 != pgm_sockaddr_ntop ((struct sockaddr*)&gsr->gsr_addr, addr, sizeof (addr)))
if (0 != pgm_sockaddr_ntop ((const struct sockaddr*)&gsr->gsr_addr, addr, sizeof (addr)))
addr[0] = 0;
pgm_snprintf_s (text, len, _TRUNCATE, "gsr_interface = %u, gsr_group = \"%s\", gsr_source = \"%s\", gsr_addr = \"%s\"",
gsr->gsr_interface, group, source, addr);
Expand Down Expand Up @@ -1205,7 +1206,7 @@ parse_group (
*/
for (res = result; NULL != res; res = res->ai_next)
{
if ((AF_INET6 != family && IN_MULTICAST(pgm_ntohl (((struct sockaddr_in*)res->ai_addr)->sin_addr.s_addr))) ||
if ((AF_INET6 != family && IN_MULTICAST(pgm_ntohl (((const struct sockaddr_in*)res->ai_addr)->sin_addr.s_addr))) ||
(AF_INET != family && IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)res->ai_addr)->sin6_addr)))
{
/* return first multicast result */
Expand Down Expand Up @@ -1446,7 +1447,7 @@ bind_gsr_to_interface (
struct pgm_group_source_req* gsr = gsr_list->data;
/* interface is a tuple of {index, address} in order to support modern IP stacks with IP aliasing. */
gsr->gsr_interface = ir->ir_interface;
memcpy (&gsr->gsr_addr, &ir->ir_addr, pgm_sockaddr_len ((struct sockaddr*)&ir->ir_addr));
memcpy (&gsr->gsr_addr, &ir->ir_addr, pgm_sockaddr_len ((const struct sockaddr*)&ir->ir_addr));
gsr_list = gsr_list->next;
}
return TRUE;
Expand Down Expand Up @@ -1554,8 +1555,8 @@ resolve_interface (
{
{
char s[INET6_ADDRSTRLEN];
if (0 != pgm_sockaddr_ntop (&resolved_interface.ir_addr, s, sizeof(s)))
s[0] == 0;
if (0 != pgm_sockaddr_ntop ((struct sockaddr*)&resolved_interface.ir_addr, s, sizeof(s)))
s[0] = 0;
pgm_debug ("Interface \"%s\" detected as \"%s\".", ir->ir_name ? ir->ir_name : "", s);
}
ir->ir_interface = resolved_interface.ir_interface;
Expand Down Expand Up @@ -1654,7 +1655,7 @@ parse_receive_entity (
if (NULL == entity) {
struct pgm_group_source_req* gsr = pgm_new0 (struct pgm_group_source_req, 1);
gsr->gsr_interface = ((struct interface_req*)(*interface_list)->data)->ir_interface;
if (!set_default_multicast_group (family, &gsr->gsr_group)) {
if (!set_default_multicast_group (family, (struct sockaddr*)&gsr->gsr_group)) {
pgm_set_error (error,
PGM_ERROR_DOMAIN_IF,
PGM_ERROR_INVAL,
Expand Down Expand Up @@ -1772,7 +1773,7 @@ parse_send_entity (
/* default send object */
send_gsr = pgm_new0 (struct pgm_group_source_req, 1);
send_gsr->gsr_interface = primary_interface->ir_interface;
memcpy (&send_gsr->gsr_addr, &primary_interface->ir_addr, pgm_sockaddr_len ((struct sockaddr*)&primary_interface->ir_addr));
memcpy (&send_gsr->gsr_addr, &primary_interface->ir_addr, pgm_sockaddr_len ((const struct sockaddr*)&primary_interface->ir_addr));
if (!parse_group (family, entity, (struct sockaddr*)&send_gsr->gsr_group, error))
{
pgm_prefix_error (error,
Expand Down Expand Up @@ -2005,6 +2006,7 @@ network_parse (
}
pgm_clear_error (&sub_error);
ec++;
/* fallthrough */

case ENTITY_RECEIVE:
if (!parse_receive_entity (family, entity, &source_list, recv_list, error))
Expand Down Expand Up @@ -2065,6 +2067,7 @@ network_parse (
goto free_lists;
}
ec++;
/* fallthrough */

case ENTITY_RECEIVE:
if (!parse_receive_entity (family, b, &source_list, recv_list, error))
Expand Down
2 changes: 2 additions & 0 deletions openpgm/pgm/include/impl/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
#define __PGM_IMPL_CHECKSUM_H__

#include <pgm/types.h>
#include <impl/cpu.h>

PGM_BEGIN_DECLS

PGM_GNUC_INTERNAL void pgm_checksum_init (const pgm_cpu_t* cpu);
uint16_t pgm_inet_checksum (const void*, uint16_t, uint16_t);
uint16_t pgm_csum_fold (uint32_t) PGM_GNUC_CONST;
uint32_t pgm_csum_block_add (uint32_t, uint32_t, const uint16_t) PGM_GNUC_CONST;
Expand Down
5 changes: 3 additions & 2 deletions openpgm/pgm/include/impl/wsastrerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@

PGM_BEGIN_DECLS

char* pgm_wsastrerror (const int);
char* pgm_adapter_strerror (const int);
const char* pgm_wsastrerror (const int);
const char* pgm_adapter_strerror (const int);
/* non-const, result must be freed. */
char* pgm_win_strerror (char*, size_t, const int);

PGM_END_DECLS
Expand Down
4 changes: 2 additions & 2 deletions openpgm/pgm/receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,9 +1367,9 @@ send_ack (
opt_len->opt_length = sizeof(struct pgm_opt_length);
opt_len->opt_total_length = pgm_htons ( sizeof(struct pgm_opt_length) +
sizeof(struct pgm_opt_header) +
(AF_INET6 == sock->send_addr.ss_family) ?
( (AF_INET6 == sock->send_addr.ss_family) ?
sizeof(struct pgm_opt6_pgmcc_feedback) :
sizeof(struct pgm_opt_pgmcc_feedback) );
sizeof(struct pgm_opt_pgmcc_feedback) ) );
opt_header = (struct pgm_opt_header*)(opt_len + 1);
opt_header->opt_type = PGM_OPT_PGMCC_FEEDBACK | PGM_OPT_END;
opt_header->opt_length = sizeof(struct pgm_opt_header) +
Expand Down
11 changes: 7 additions & 4 deletions openpgm/pgm/rxw.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ pgm_rxw_add (
}

const struct pgm_sk_buff_t* const first_skb = _pgm_rxw_peek (window, _pgm_rxw_tg_sqn (window, skb->sequence));
const pgm_rxw_state_t* const first_state = (pgm_rxw_state_t*)&first_skb->cb;
const pgm_rxw_state_t* const first_state = (const pgm_rxw_state_t*)&first_skb->cb;

if (_pgm_rxw_tg_sqn (window, skb->sequence) == _pgm_rxw_tg_sqn (window, window->lead)) {
window->has_event = 1;
Expand Down Expand Up @@ -801,7 +801,7 @@ _pgm_rxw_is_apdu_lost (
if (NULL == first_skb)
return TRUE;

const pgm_rxw_state_t* first_state = (pgm_rxw_state_t*)&first_skb->cb;
const pgm_rxw_state_t* first_state = (const pgm_rxw_state_t*)&first_skb->cb;
if (PGM_PKT_STATE_LOST_DATA == first_state->pkt_state)
return TRUE;

Expand Down Expand Up @@ -1255,7 +1255,8 @@ pgm_rxw_readv (
} else {
pgm_trace (PGM_LOG_ROLE_RX_WINDOW,_("Locking trail at commit window"));
}
/* fall through */
/* fallthrough */

case PGM_PKT_STATE_BACK_OFF:
case PGM_PKT_STATE_WAIT_NCF:
case PGM_PKT_STATE_WAIT_DATA:
Expand Down Expand Up @@ -1453,6 +1454,8 @@ _pgm_rxw_reconstruct (
tg_opts[ window->rs.k + rs_h ] = (pgm_gf8_t*)skb->pgm_opt_fragment;
offsets[ j ] = window->rs.k + rs_h;
++rs_h;
/* fallthrough */

/* fall through and alloc new skb for reconstructed data */
case PGM_PKT_STATE_BACK_OFF:
case PGM_PKT_STATE_WAIT_NCF:
Expand Down Expand Up @@ -2053,8 +2056,8 @@ _pgm_rxw_recovery_update (
case PGM_PKT_STATE_BACK_OFF:
case PGM_PKT_STATE_WAIT_NCF:
pgm_rxw_state (window, skb, PGM_PKT_STATE_WAIT_DATA);
/* fallthrough */

/* fall through */
case PGM_PKT_STATE_WAIT_DATA:
state->timer_expiry = nak_rdata_expiry;
return PGM_RXW_UPDATED;
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/sockaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pgm_in_len2mask (
uint8_t* p;

p = (uint8_t*)mask;
memset (mask, sizeof (*mask), 0);
memset (mask, 0, sizeof (*mask));
for (i = 0; i < prefixlen / 8; i++)
p[i] = 0xff;
if (prefixlen % 8)
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,7 @@ pgm_bind3 (
memset (&send_addr, 0, sizeof(send_addr));

if (send_req->ir_address.ss_family != AF_UNSPEC)
memcpy(&send_addr, &send_req->ir_address, pgm_sockaddr_len ((struct sockaddr *)&send_req->ir_address));
memcpy(&send_addr, &send_req->ir_address, pgm_sockaddr_len ((const struct sockaddr *)&send_req->ir_address));
else if (!pgm_if_indextoaddr (send_req->ir_interface,
sock->family,
send_req->ir_scope_id,
Expand Down
2 changes: 1 addition & 1 deletion openpgm/pgm/txw.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ pgm_txw_add (
pgm_assert ((char*)skb->data > (char*)skb->head);
pgm_assert ((sizeof(struct pgm_header) + sizeof(struct pgm_data)) <= (size_t)((char*)skb->data - (char*)skb->head));

pgm_debug ("add (window:%p skb:%p)", (const char*)window, (const char*)skb);
pgm_debug ("add (window:%p skb:%p)", (const void*)window, (const void*)skb);

if (pgm_txw_is_full (window))
{
Expand Down
11 changes: 7 additions & 4 deletions openpgm/pgm/wsastrerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@

/* compatibility stubs */

char *
const char*
pgm_wsastrerror (
const int wsa_errnum
)
{
(void)wsa_errnum;
return _("Unknown.");
}

char*
const char*
pgm_adapter_strerror (
const int adapter_errnum
)
{
(void)adapter_errnum;
return _("Unknown.");
}

Expand All @@ -50,14 +52,15 @@ pgm_win_strerror (
const int win_errnum
)
{
(void)win_errnum;
pgm_strncpy_s (buf, buflen, _("Unknown."), _TRUNCATE);
return buf;
}

#else
# include <ws2tcpip.h>

char*
const char*
pgm_wsastrerror (
const int wsa_errnum
)
Expand Down Expand Up @@ -352,7 +355,7 @@ pgm_wsastrerror (
}
}

char*
const char*
pgm_adapter_strerror (
const int adapter_errnum
)
Expand Down

0 comments on commit e2ff9cf

Please sign in to comment.