* Return the next larger or smaller MTU plateau (table from RFC 1191) * given current value MTU. If DIR is less than zero, a larger plateau * is returned; otherwise, a smaller value is returned. */
| 1037 | * is returned; otherwise, a smaller value is returned. |
| 1038 | */ |
| 1039 | int |
| 1040 | ip_next_mtu(int mtu, int dir) |
| 1041 | { |
| 1042 | static int mtutab[] = { |
| 1043 | 65535, 32000, 17914, 8166, 4352, 2002, 1492, 1280, 1006, 508, |
| 1044 | 296, 68, 0 |
| 1045 | }; |
| 1046 | int i, size; |
| 1047 | |
| 1048 | size = (sizeof mtutab) / (sizeof mtutab[0]); |
| 1049 | if (dir >= 0) { |
| 1050 | for (i = 0; i < size; i++) |
| 1051 | if (mtu > mtutab[i]) |
| 1052 | return mtutab[i]; |
| 1053 | } else { |
| 1054 | for (i = size - 1; i >= 0; i--) |
| 1055 | if (mtu < mtutab[i]) |
| 1056 | return mtutab[i]; |
| 1057 | if (mtu == mtutab[0]) |
| 1058 | return mtutab[0]; |
| 1059 | } |
| 1060 | return 0; |
| 1061 | } |
| 1062 | #endif /* INET */ |
| 1063 | |
| 1064 | /* |
no outgoing calls
no test coverage detected