|
|
|
|
|
by tathougies
2779 days ago
|
|
Why do people keep bringing this up. Here is how you encapsulate any network protocol in UDP. void encaps_udp(void *out_buf, void *old_pkt, size_t old_pkt_sz) {
struct udphdr udp;
udp.dport = UDP_DEST_PORT;
udp.sport = UDP_SRC_PORT;
memcpy(out_buf, &udp, sizeof(udp));
memcpy(out_buf + sizeof(udp), old_pkt, old_pkt_sz);
}
(Accounting for memory overflow in the real world of course).Of course, this encapsulation for SCTP is even standardized in case it wasn't obvious that this is how you encapsulate protocols. |
|
More importantly: You are missing the point. Great, you have encapsulated your protocol in UDP. Now, what do you notice? Your ISP is throttling your protocol because for some braindead reason their traffic management has categorized it as some sort of unimportant protocol, probably P2P or something. Or they just throttle UDP in general, because who uses UDP besides DNS and VoIP? So, high bandwidth UDP usage is obviously a DoS, and we don't want that! If you are unlucky, maybe they even shut off your server because it is obviously part of a botnet?
OK, so enough people complain to their ISPs that SCTP over UDP doesn't work. What happens? Exactly, ISPs start putting in rules that "recognize SCTP over UDP". So next time you want to try out a new protocol or extend SCTP somehow, you run into the exact same problem.
The difficult part isn't stuffing bytes into UDP packets, the difficult part is making sure it actually works reliably and fast over the public internet.