ip_fragment.c (163849ea9b4c5d50fbd324692461983d18faadad) ip_fragment.c (2c8c1e7297e19bdef3c178c3ea41d898a7716e3e)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * The IP fragmentation functionality.
7 *
8 * Authors: Fred N. van Kempen <waltje@uWalt.NL.Mugnet.ORG>

--- 632 unchanged lines hidden (view full) ---

641 .maxlen = sizeof(int),
642 .mode = 0644,
643 .proc_handler = proc_dointvec_minmax,
644 .extra1 = &zero
645 },
646 { }
647};
648
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * The IP fragmentation functionality.
7 *
8 * Authors: Fred N. van Kempen <waltje@uWalt.NL.Mugnet.ORG>

--- 632 unchanged lines hidden (view full) ---

641 .maxlen = sizeof(int),
642 .mode = 0644,
643 .proc_handler = proc_dointvec_minmax,
644 .extra1 = &zero
645 },
646 { }
647};
648
649static int ip4_frags_ns_ctl_register(struct net *net)
649static int __net_init ip4_frags_ns_ctl_register(struct net *net)
650{
651 struct ctl_table *table;
652 struct ctl_table_header *hdr;
653
654 table = ip4_frags_ns_ctl_table;
655 if (!net_eq(net, &init_net)) {
656 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
657 if (table == NULL)

--- 13 unchanged lines hidden (view full) ---

671
672err_reg:
673 if (!net_eq(net, &init_net))
674 kfree(table);
675err_alloc:
676 return -ENOMEM;
677}
678
650{
651 struct ctl_table *table;
652 struct ctl_table_header *hdr;
653
654 table = ip4_frags_ns_ctl_table;
655 if (!net_eq(net, &init_net)) {
656 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
657 if (table == NULL)

--- 13 unchanged lines hidden (view full) ---

671
672err_reg:
673 if (!net_eq(net, &init_net))
674 kfree(table);
675err_alloc:
676 return -ENOMEM;
677}
678
679static void ip4_frags_ns_ctl_unregister(struct net *net)
679static void __net_exit ip4_frags_ns_ctl_unregister(struct net *net)
680{
681 struct ctl_table *table;
682
683 table = net->ipv4.frags_hdr->ctl_table_arg;
684 unregister_net_sysctl_table(net->ipv4.frags_hdr);
685 kfree(table);
686}
687

--- 11 unchanged lines hidden (view full) ---

699{
700}
701
702static inline void ip4_frags_ctl_register(void)
703{
704}
705#endif
706
680{
681 struct ctl_table *table;
682
683 table = net->ipv4.frags_hdr->ctl_table_arg;
684 unregister_net_sysctl_table(net->ipv4.frags_hdr);
685 kfree(table);
686}
687

--- 11 unchanged lines hidden (view full) ---

699{
700}
701
702static inline void ip4_frags_ctl_register(void)
703{
704}
705#endif
706
707static int ipv4_frags_init_net(struct net *net)
707static int __net_init ipv4_frags_init_net(struct net *net)
708{
709 /*
710 * Fragment cache limits. We will commit 256K at one time. Should we
711 * cross that limit we will prune down to 192K. This should cope with
712 * even the most extreme cases without allowing an attacker to
713 * measurably harm machine performance.
714 */
715 net->ipv4.frags.high_thresh = 256 * 1024;

--- 5 unchanged lines hidden (view full) ---

721 */
722 net->ipv4.frags.timeout = IP_FRAG_TIME;
723
724 inet_frags_init_net(&net->ipv4.frags);
725
726 return ip4_frags_ns_ctl_register(net);
727}
728
708{
709 /*
710 * Fragment cache limits. We will commit 256K at one time. Should we
711 * cross that limit we will prune down to 192K. This should cope with
712 * even the most extreme cases without allowing an attacker to
713 * measurably harm machine performance.
714 */
715 net->ipv4.frags.high_thresh = 256 * 1024;

--- 5 unchanged lines hidden (view full) ---

721 */
722 net->ipv4.frags.timeout = IP_FRAG_TIME;
723
724 inet_frags_init_net(&net->ipv4.frags);
725
726 return ip4_frags_ns_ctl_register(net);
727}
728
729static void ipv4_frags_exit_net(struct net *net)
729static void __net_exit ipv4_frags_exit_net(struct net *net)
730{
731 ip4_frags_ns_ctl_unregister(net);
732 inet_frags_exit_net(&net->ipv4.frags, &ip4_frags);
733}
734
735static struct pernet_operations ip4_frags_ops = {
736 .init = ipv4_frags_init_net,
737 .exit = ipv4_frags_exit_net,

--- 18 unchanged lines hidden ---
730{
731 ip4_frags_ns_ctl_unregister(net);
732 inet_frags_exit_net(&net->ipv4.frags, &ip4_frags);
733}
734
735static struct pernet_operations ip4_frags_ops = {
736 .init = ipv4_frags_init_net,
737 .exit = ipv4_frags_exit_net,

--- 18 unchanged lines hidden ---