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

Function sysctl_maxfragpackets

freebsd/netinet/ip_reass.c:745–778  ·  view source on GitHub ↗

* Change the limit on the UMA zone, or disable the fragment allocation * at all. Since 0 and -1 is a special values here, we need our own handler, * instead of sysctl_handle_uma_zone_max(). */

Source from the content-addressed store, hash-verified

743 * instead of sysctl_handle_uma_zone_max().
744 */
745static int
746sysctl_maxfragpackets(SYSCTL_HANDLER_ARGS)
747{
748 int error, max;
749
750 if (V_noreass == 0) {
751 max = uma_zone_get_max(V_ipq_zone);
752 if (max == 0)
753 max = -1;
754 } else
755 max = 0;
756 error = sysctl_handle_int(oidp, &max, 0, req);
757 if (error || !req->newptr)
758 return (error);
759 if (max > 0) {
760 /*
761 * XXXRW: Might be a good idea to sanity check the argument
762 * and place an extreme upper bound.
763 */
764 max = uma_zone_set_max(V_ipq_zone, max);
765 V_ipreass_maxbucketsize = imax(max / (IPREASS_NHASH / 2), 1);
766 ipreass_drain_tomax();
767 V_noreass = 0;
768 } else if (max == 0) {
769 V_noreass = 1;
770 ipreass_drain();
771 } else if (max == -1) {
772 V_noreass = 0;
773 uma_zone_set_max(V_ipq_zone, 0);
774 V_ipreass_maxbucketsize = INT_MAX;
775 } else
776 return (EINVAL);
777 return (0);
778}
779
780/*
781 * Seek for old fragment queue header that can be reused. Try to

Callers

nothing calls this directly

Calls 6

uma_zone_get_maxFunction · 0.85
sysctl_handle_intFunction · 0.85
uma_zone_set_maxFunction · 0.85
imaxFunction · 0.85
ipreass_drain_tomaxFunction · 0.85
ipreass_drainFunction · 0.85

Tested by

no test coverage detected