Use AF_INET instead of PF_INET

I believe it should be more portable this way, since AF_INET is required
to be present in <sys/socket.h> in POSIX.
This commit is contained in:
2018-07-18 00:20:01 +02:00
parent c3acef56ef
commit a9c834b6aa
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -230,7 +230,7 @@ send_spa_packet_tcp_raw(const char *spa_data, const int sd_len,
return res;
}
sock = socket (PF_INET, SOCK_RAW, IPPROTO_RAW);
sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW);
if (sock < 0)
{
log_msg(LOG_VERBOSITY_ERROR, "send_spa_packet_tcp_raw: create socket: ", strerror(errno));
@@ -343,7 +343,7 @@ send_spa_packet_udp_raw(const char *spa_data, const int sd_len,
return res;
}
sock = socket (PF_INET, SOCK_RAW, IPPROTO_RAW);
sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW);
if (sock < 0)
{
log_msg(LOG_VERBOSITY_ERROR, "send_spa_packet_udp_raw: create socket: ", strerror(errno));
@@ -441,7 +441,7 @@ send_spa_packet_icmp(const char *spa_data, const int sd_len,
return res;
}
sock = socket (PF_INET, SOCK_RAW, IPPROTO_RAW);
sock = socket (AF_INET, SOCK_RAW, IPPROTO_RAW);
if (sock < 0)
{
+1 -1
View File
@@ -94,7 +94,7 @@ run_tcp_server(fko_srv_options_t *opts)
/* Now, let's make a TCP server
*/
if ((s_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
if ((s_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
{
log_msg(LOG_ERR, "run_tcp_server: socket() failed: %s",
strerror(errno));