mtrtype = IPPROTO_TCP;
break;
case 'S':
+#ifdef HAS_SCTP
if (mtrtype != IPPROTO_ICMP) {
fprintf(stderr, "-u , -T and -S are mutually exclusive.\n");
exit(EXIT_FAILURE);
remoteport = 80;
}
mtrtype = IPPROTO_SCTP;
+#else
+ fprintf (stderr, "No SCTP support found at compiletime\n");
+ exit (EXIT_FAILURE);
+#endif
+ break;
case 'b':
show_ips = 1;
break;
uint32 seq;
};
+// This ifdef is unnecessary. But it should trigger errors if I forget
+// an ifdef HAS_SCTP further down. (Success! I forgot one and the compiler
+// told me the line number!)
+#ifdef HAS_SCTP
/* Structure of an SCTP header */
struct SCTPHeader {
uint16 srcport;
uint16 dstport;
uint32 veri_tag;
};
+#endif
/* Structure of an IPv4 UDP pseudoheader. */
struct UDPv4PHeader {
connect(s, (struct sockaddr *) &remote, len);
}
+#ifdef HAS_SCTP
/* Attempt to connect to a SCTP port with a TTL */
void net_send_sctp(int index)
{
connect(s, (struct sockaddr *) &remote, len);
}
+#endif
/* Attempt to find the host at a particular number of hops away */
void net_send_query(int index)
return;
}
+#ifdef HAS_SCTP
if (mtrtype == IPPROTO_SCTP) {
net_send_sctp(index);
return;
}
+#endif
/*ok char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/
char packet[MAXPACKET];
struct ICMPHeader *header = NULL;
struct UDPHeader *udpheader = NULL;
struct TCPHeader *tcpheader = NULL;
+#ifdef HAS_SCTP
struct SCTPHeader *sctpheader = NULL;
+#endif
struct timeval now;
ip_t * fromaddress = NULL;
int echoreplytype = 0, timeexceededtype = 0, unreachabletype = 0;
seq_num = ntohs(tcpheader->srcport);
}
break;
-
+
+#ifdef HAS_SCTP
case IPPROTO_SCTP:
if (header->type == timeexceededtype || header->type == unreachabletype) {
switch ( af ) {
seq_num = ntohs(sctpheader->srcport);
}
break;
+#endif
}
if (seq_num)
net_process_ping (seq_num, mpls, (void *) fromaddress, now);