This commit is contained in:
Michael Kerrisk 2007-12-30 05:42:10 +00:00
parent 0119b1823b
commit 9584332da4
1 changed files with 8 additions and 9 deletions

View File

@ -168,16 +168,15 @@ int *ttlptr;
int received_ttl;
/* Receive auxiliary data in msgh */
for (cmsg = CMSG_FIRSTHDR(&msgh);
cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
if (cmsg\->cmsg_level == IPPROTO_IP
&& cmsg\->cmsg_type == IP_TTL) {
ttlptr = (int *) CMSG_DATA(cmsg);
received_ttl = *ttlptr;
break;
}
for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
if (cmsg\->cmsg_level == IPPROTO_IP
&& cmsg\->cmsg_type == IP_TTL) {
ttlptr = (int *) CMSG_DATA(cmsg);
received_ttl = *ttlptr;
break;
}
}
if (cmsg == NULL) {
/*
* Error: IP_TTL not enabled or small buffer