Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F53367472
MSS from getsockopt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
BBlack
May 15 2024, 6:58 PM
2024-05-15 18:58:58 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
MSS from getsockopt
View Options
----- OUTPUT ------
bblack@cp4049:~$ ./mss-check
Checking text@ulsfo: MSS is 1448
Checking upload@ulsfo: MSS is 1428
------ UGLY QUICK HACK C SOURCE BELOW ----
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
void check_mss(struct sockaddr_in* server) {
const int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (connect(sock, (struct sockaddr*)server, sizeof(*server))) {
perror("connect() failed");
abort();
}
int maxseg = 0;
socklen_t optlen = sizeof(maxseg);
if (getsockopt(sock, SOL_TCP, TCP_MAXSEG, &maxseg, &optlen)) {
perror("getsockopt() failed");
abort();
}
printf("MSS is %i\n", maxseg);
}
int main(int argc, char* argv[]) {
struct sockaddr_in server_text = { 0 };
server_text.sin_family = AF_INET;
server_text.sin_addr.s_addr = htonl(0xC6231A60);
server_text.sin_port = htons(443);
printf("Checking text@ulsfo: ");
check_mss(&server_text);
struct sockaddr_in server_upload = { 0 };
server_upload.sin_family = AF_INET;
server_upload.sin_addr.s_addr = htonl(0xC6231A70);
server_upload.sin_port = htons(443);
printf("Checking upload@ulsfo: ");
check_mss(&server_upload);
return 0;
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17369889
Default Alt Text
MSS from getsockopt (1 KB)
Attached To
Mode
P62422 MSS from getsockopt
Attached
Detach File
Event Timeline
Log In to Comment