-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #421 from TrekkieCoder/main
cicd: fixed sctp client for various scenarios
- Loading branch information
Showing
10 changed files
with
88 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ jobs: | |
run: | | ||
cd cicd/k3s-flannel-incluster | ||
./config.sh | ||
sleep 90 | ||
./validation.sh | ||
cd - | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include <sys/socket.h> | ||
#include <sys/types.h> | ||
#include <netinet/in.h> | ||
#include <netinet/sctp.h> | ||
#include <arpa/inet.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <errno.h> | ||
|
||
#define RECVBUFSIZE 4096 | ||
#define PPID 1234 | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
|
||
struct sockaddr_in servaddr = {0}; | ||
struct sockaddr_in laddr = {0}; | ||
int sockfd, in, flags; | ||
char *saddr; | ||
int sport, lport, error = 0; | ||
struct sctp_status status = {0}; | ||
struct sctp_sndrcvinfo sndrcvinfo = {0}; | ||
struct sctp_event_subscribe events = {0}; | ||
struct sctp_initmsg initmsg = {0}; | ||
char msg[1024] = {0}; | ||
char buff[1024] = {0}; | ||
socklen_t opt_len; | ||
socklen_t slen = (socklen_t) sizeof(struct sockaddr_in); | ||
|
||
|
||
sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); | ||
lport = atoi(argv[2]); | ||
|
||
laddr.sin_family = AF_INET; | ||
laddr.sin_addr.s_addr = inet_addr(argv[1]); | ||
laddr.sin_port = lport?htons(lport):0; | ||
|
||
//bind to local address | ||
error = bind(sockfd, (struct sockaddr *)&laddr, sizeof(struct sockaddr_in)); | ||
if (error != 0) { | ||
printf("\n\n\t\t***r: error binding addr:" | ||
" %s. ***\n", strerror(errno)); | ||
exit(1); | ||
} | ||
|
||
saddr = argv[3]; | ||
sport = atoi(argv[4]); | ||
bzero( (void *)&servaddr, sizeof(servaddr) ); | ||
servaddr.sin_family = AF_INET; | ||
servaddr.sin_port = htons(sport); | ||
servaddr.sin_addr.s_addr = inet_addr( saddr ); | ||
|
||
connect( sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)); | ||
|
||
while(1) | ||
{ | ||
in = sctp_recvmsg(sockfd, (void*)buff, RECVBUFSIZE, | ||
(struct sockaddr *)&servaddr, | ||
&slen, &sndrcvinfo, &flags); | ||
if (in > 0 && in < RECVBUFSIZE - 1) | ||
{ | ||
buff[in] = 0; | ||
printf("%s",buff); | ||
break; | ||
} | ||
} | ||
|
||
close(sockfd); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters