Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCTP support #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ int mtr_curses_keyaction(void)
switch ( mtrtype ) {
case IPPROTO_ICMP:
case IPPROTO_TCP:
case IPPROTO_SCTP:
mtrtype = IPPROTO_UDP;
break;
case IPPROTO_UDP:
Expand All @@ -276,12 +277,25 @@ int mtr_curses_keyaction(void)
switch ( mtrtype ) {
case IPPROTO_ICMP:
case IPPROTO_UDP:
case IPPROTO_SCTP:
mtrtype = IPPROTO_TCP;
break;
case IPPROTO_TCP:
mtrtype = IPPROTO_ICMP;
break;
}
}
if (tolower(c) == 's') {
switch ( mtrtype ) {
case IPPROTO_ICMP:
case IPPROTO_UDP:
case IPPROTO_TCP:
mtrtype = IPPROTO_SCTP;
break;
case IPPROTO_SCTP:
mtrtype = IPPROTO_ICMP;
break;
}
return ActionNone;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new feature: here's a new switch key s for SCTP

Copy link

@LionNatsu LionNatsu Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it will surely not work. s conflicted with line 135, the key to Change Packet Size.

}
/* reserve to display help message -Min */
Expand Down
2 changes: 1 addition & 1 deletion net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ void net_process_fds(fd_set *writefd)
for (at = 0; at < MaxSequence; at++) {
fd = sequence[at].socket;
if (fd > 0 && FD_ISSET(fd, writefd)) {
r = write(fd, "G", 1);
r = send(fd, "G", 1, MSG_NOSIGNAL);
/* if write was successful, or connection refused we have
* (probably) reached the remote address. Anything else happens to the
* connection, we write it off to avoid leaking sockets */
Expand Down
4 changes: 2 additions & 2 deletions select.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void select_loop(void) {
FD_SET(netfd, &readfd);
if(netfd >= maxfd) maxfd = netfd + 1;

if (mtrtype == IPPROTO_TCP)
if (mtrtype == IPPROTO_TCP || mtrtype == IPPROTO_SCTP)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the event handler(s) for socket? (I am not good at operating file descriptor)

net_add_fds(&writefd, &maxfd);

do {
Expand Down Expand Up @@ -266,7 +266,7 @@ void select_loop(void) {
}

/* Check for activity on open sockets */
if (mtrtype == IPPROTO_TCP)
if (mtrtype == IPPROTO_TCP || mtrtype == IPPROTO_SCTP)
net_process_fds(&writefd);
}
return;
Expand Down