MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ip_next_mtu

Function ip_next_mtu

freebsd/netinet/ip_icmp.c:1039–1061  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1037 * is returned; otherwise, a smaller value is returned.
1038 */
1039int
1040ip_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/*

Callers 2

ip_input.cFile · 0.85
tcp_ctlinputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected