static int udp_init_net(struct net *net, u_int16_t proto) { int ret; struct nf_udp_net *un = udp_pernet(net); struct nf_proto_net *pn = &un->pn; if (!pn->users) { int i; for (i = 0; i < UDP_CT_MAX; i++) un->timeouts[i] = udp_timeouts[i]; } if (proto == AF_INET) { ret = udp_kmemdup_compat_sysctl_table(pn, un); if (ret < 0) return ret; ret = udp_kmemdup_sysctl_table(pn, un); if (ret < 0) nf_ct_kfree_compat_sysctl_table(pn); } else ret = udp_kmemdup_sysctl_table(pn, un); return ret; }
static int udp_init_net(struct net *net, u_int16_t proto) { struct nf_udp_net *un = udp_pernet(net); struct nf_proto_net *pn = &un->pn; if (!pn->users) { int i; for (i = 0; i < UDP_CT_MAX; i++) un->timeouts[i] = udp_timeouts[i]; } return udp_kmemdup_sysctl_table(pn, un); }
static int udp_timeout_nlattr_to_obj(struct nlattr *tb[], struct net *net, void *data) { unsigned int *timeouts = data; struct nf_udp_net *un = udp_pernet(net); /* set default timeouts for UDP. */ timeouts[UDP_CT_UNREPLIED] = un->timeouts[UDP_CT_UNREPLIED]; timeouts[UDP_CT_REPLIED] = un->timeouts[UDP_CT_REPLIED]; if (tb[CTA_TIMEOUT_UDP_UNREPLIED]) { timeouts[UDP_CT_UNREPLIED] = ntohl(nla_get_be32(tb[CTA_TIMEOUT_UDP_UNREPLIED])) * HZ; } if (tb[CTA_TIMEOUT_UDP_REPLIED]) { timeouts[UDP_CT_REPLIED] = ntohl(nla_get_be32(tb[CTA_TIMEOUT_UDP_REPLIED])) * HZ; } return 0; }
static unsigned int *udp_get_timeouts(struct net *net) { return udp_pernet(net)->timeouts; }