Skip to content

Commit

Permalink
Small cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Dec 2, 2023
1 parent d9c7a58 commit 860cb22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions modules/proto_sctp/sctp_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ int proto_sctp_send(const struct socket_info *source, char *buf, unsigned len,
{
int n;
int tolen;
struct sockaddr s = to->s; /* XXX Linux defines sctp_sendmsg without const */
union sockaddr_union _to = *to; /* XXX Linux defines sctp_sendmsg without const */

tolen=sockaddru_len(*to);
again:
n=sctp_sendmsg(source->socket, buf, len, &s, tolen, 0, 0, 0, 0, 0);
n=sctp_sendmsg(source->socket, buf, len, &_to.s, tolen, 0, 0, 0, 0, 0);
#ifdef XL_DEBUG
LM_INFO("send status: %d\n", n);
#endif
Expand Down
6 changes: 3 additions & 3 deletions socket_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ int new_sock2list(struct socket_id *sid, struct socket_info_full** list)
* WARNING: it only works with ipv6 addresses on FreeBSD
* return: -1 on error, 0 on success
*/
static int expand_interface(struct socket_info *si, struct socket_info_full** list)
static int expand_interface(const struct socket_info *si, struct socket_info_full** list)
{
int ret = -1;
struct ip_addr addr;
Expand Down Expand Up @@ -838,7 +838,7 @@ int fix_socket_list(struct socket_info_full **list)
for (l=sif->next;l;){
next=l->next;
si = &sif->socket_info;
struct socket_info *sl = &l->socket_info;
const struct socket_info *sl = &l->socket_info;
if ((si->port_no==sl->port_no) &&
(si->address.af==sl->address.af) &&
(memcmp(si->address.u.addr, sl->address.u.addr, si->address.len)
Expand Down Expand Up @@ -876,7 +876,7 @@ int fix_socket_list(struct socket_info_full **list)
LM_WARN("removing entry %s:%s [%s]:%s\n",
get_proto_name(si->proto), si->name.s,
si->address_str.s, si->port_no_str.s);
l = si;
l = sif;
sif=sif->next;
sock_listrm(list, l);
free_sock_info(l);
Expand Down
9 changes: 3 additions & 6 deletions socket_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ struct socket_info_full {
struct socket_info_full* prev;
};

#define get_head_si(sifp) (&(sifp)->socket_info)
#define get_si_next(sifp) (&((sifp)->next->socket_info))

#define get_socket_real_name(_s) \
(&(_s)->sock_str)

Expand Down Expand Up @@ -162,9 +159,9 @@ const struct socket_info* find_si(const struct ip_addr* ip, unsigned short port,

#define set_sip_defaults( _port, _proto) \
do { \
if (_proto==PROTO_NONE) _proto = PROTO_UDP; \
if ((_proto)==PROTO_NONE) (_proto) = PROTO_UDP; \
if (_port==0) { \
if (_proto==PROTO_TLS) _port = SIPS_PORT; else\
if ((_proto)==PROTO_TLS) _port = SIPS_PORT; else\
_port = SIP_PORT; \
} \
} while(0)
Expand Down Expand Up @@ -608,7 +605,7 @@ static inline char* socket2str(const struct socket_info *sock, char *s, int *len


#define get_sock_info_list(_proto) \
((_proto>=PROTO_FIRST && _proto<PROTO_LAST)?(&protos[_proto].listeners):0)
(((_proto)>=PROTO_FIRST && (_proto)<PROTO_LAST)?(&protos[_proto].listeners):0)


int probe_max_sock_buff( int sock, int buff_choice, int buff_max,
Expand Down

0 comments on commit 860cb22

Please sign in to comment.