Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
net/mptcp/sockopt.c
static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, sockptr_t optval, unsigned int optlen) { struct sock *sk = (void *)msk; int ret, val; switch (optname) { case TCP_INQ: ret = mptcp_get_int_option(msk, optval, optlen, &val); if (ret) retur...
[ 1, 0 ]
Linux Kernel
net/mptcp/sockopt.c
int mptcp_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval, unsigned int optlen) { struct mptcp_sock *msk = mptcp_sk(sk); struct sock *ssk; pr_debug("msk=%p", msk); if (level == SOL_SOCKET) return mptcp_setsockopt_sol_socket(msk, optname, optval, optlen); if (!m...
[ 0, 0 ]
Linux Kernel
net/mptcp/sockopt.c
void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) { u32 flags = 0; u8 val; memset(info, 0, sizeof(*info)); info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm....
[ 1, 0 ]
Linux Kernel
net/mptcp/sockopt.c
static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen) { struct mptcp_info m_info; int len; if (get_user(len, optlen)) return -EFAULT; len = min_t(unsigned int, len, sizeof(struct mptcp_info)); mptcp_diag_fill_info(msk, &m_inf...
[ 1, 0 ]
Linux Kernel
net/mptcp/sockopt.c
static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname, char __user *optval, int __user *optlen) { switch (optname) { case TCP_ULP: case TCP_CONGESTION: case TCP_INFO: case TCP_CC_INFO: case TCP_DEFER_ACCEPT: case TCP_FASTOPEN: case TCP_FASTOPEN_CONN...
[ 1, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void SUBFLOW_REQ_INC_STATS(struct request_sock *req, enum linux_mptcp_mib_field field) { MPTCP_INC_STATS(sock_net(req_to_sk(req)), field); }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk) { return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport; }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst, struct flowi *fl, struct request_sock *req, struct tcp_fastopen_cookie *foc, enum tcp_synack_type synack_type, ...
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void mptcp_set_connected(struct sock *sk) { mptcp_data_lock(sk); if (!sock_owned_by_user(sk)) __mptcp_set_connected(sk); else __set_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->cb_flags); mptcp_data_unlock(sk); }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
struct request_sock * mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener, bool attach_listener) { if (ops->family == AF_INET) ops = &mptcp_subflow_v4_request_sock_ops; #if IS_ENABLED(CONFIG_MPTCP_IPV6) else if (ops->family == AF_INET6) ops = &mp...
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void mptcp_force_close(struct sock *sk) { inet_sk_state_store(sk, TCP_CLOSE); sk_common_release(sk); }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void subflow_ulp_fallback(struct sock *sk, struct mptcp_subflow_context *old_ctx) { struct inet_connection_sock *icsk = inet_csk(sk); mptcp_subflow_tcp_fallback(sk, old_ctx); icsk->icsk_ulp_ops = NULL; rcu_assign_pointer(icsk->icsk_ulp_data, NULL); tcp_sk(sk)->is_mptc...
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void subflow_drop_ctx(struct sock *ssk) { struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(ssk); if (!ctx) return; subflow_ulp_fallback(ssk, ctx); if (ctx->conn) sock_put(ctx->conn); kfree_rcu(ctx, rcu); }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
void mptcp_subflow_fully_established( struct mptcp_subflow_context *subflow, const struct mptcp_options_received *mp_opt) { struct mptcp_sock *msk = mptcp_sk(subflow->conn); subflow_set_remote_key(msk, subflow, mp_opt); subflow->fully_established = 1; WRITE_ONCE(msk->fully_established, true); if (s...
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
bool mptcp_subflow_data_available(struct sock *sk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); if (subflow->map_valid && mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { subflow->map_valid = 0; WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_NODATA); pr_debug(...
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
void mptcp_space(const struct sock *ssk, int *space, int *full_space) { const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); const struct sock *sk = subflow->conn; *space = __mptcp_space(sk); *full_space = tcp_full_space(sk); }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void subflow_error_report(struct sock *ssk) { struct sock *sk = mptcp_subflow_ctx(ssk)->conn; mptcp_data_lock(sk); if (!sock_owned_by_user(sk)) __mptcp_error_report(sk); else __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); mptcp_data_unlock(sk); }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static void mptcp_subflow_ops_override(struct sock *ssk) { #if IS_ENABLED(CONFIG_MPTCP_IPV6) if (ssk->sk_prot == &tcpv6_prot) ssk->sk_prot = &tcpv6_prot_override; else #endif ssk->sk_prot = &tcp_prot_override; }
[ 0, 0 ]
Linux Kernel
net/mptcp/subflow.c
static int subflow_ops_init(struct request_sock_ops *subflow_ops) { subflow_ops->obj_size = sizeof(struct mptcp_subflow_request_sock); subflow_ops->slab = kmem_cache_create(subflow_ops->slab_name, subflow_ops->obj_size, 0, SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU, NULL); if (!subflow_op...
[ 1, 0 ]
Linux Kernel
net/mptcp/syncookies.c
static void mptcp_join_store_state(struct join_entry *entry, const struct mptcp_subflow_request_sock *subflow_req) { entry->token = subflow_req->token; entry->remote_nonce = subflow_req->remote_nonce; entry->local_nonce = subflow_req->local_nonce; entry->backup = subflow_req->backup; e...
[ 0, 0 ]
Linux Kernel
net/mptcp/token.c
static void mptcp_crypto_key_gen_sha(u64 *key, u32 *token, u64 *idsn) { get_random_bytes(key, sizeof(u64)); mptcp_crypto_key_sha(*key, token, idsn); }
[ 1, 0 ]
Linux Kernel
net/mptcp/token_test.c
static struct mptcp_subflow_request_sock *build_req_sock(struct kunit *test) { struct mptcp_subflow_request_sock *req; req = kunit_kzalloc(test, sizeof(struct mptcp_subflow_request_sock), GFP_USER); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, req); mptcp_token_init_request((struct request_sock *)req); sock_net...
[ 1, 0 ]
Linux Kernel
net/mptcp/token_test.c
static struct inet_connection_sock *build_icsk(struct kunit *test) { struct inet_connection_sock *icsk; icsk = kunit_kzalloc(test, sizeof(struct inet_connection_sock), GFP_USER); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, icsk); return icsk; }
[ 1, 0 ]
Linux Kernel
net/mptcp/token_test.c
static struct mptcp_sock *build_msk(struct kunit *test) { struct mptcp_sock *msk; msk = kunit_kzalloc(test, sizeof(struct mptcp_sock), GFP_USER); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, msk); refcount_set(&((struct sock *)msk)->sk_refcnt, 1); sock_net_set((struct sock *)msk, &init_net); return msk; }
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-cmd.c
static int ncsi_cmd_handler_default(struct sk_buff *skb, struct ncsi_cmd_arg *nca) { struct ncsi_cmd_pkt *cmd; cmd = skb_put_zero(skb, sizeof(*cmd)); ncsi_cmd_build_header(&cmd->cmd.common, nca); return 0; }
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-cmd.c
static int ncsi_cmd_handler_dc(struct sk_buff *skb, struct ncsi_cmd_arg *nca) { struct ncsi_cmd_dc_pkt *cmd; cmd = skb_put_zero(skb, sizeof(*cmd)); cmd->ald = nca->bytes[0]; ncsi_cmd_build_header(&cmd->cmd.common, nca); return 0; }
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-cmd.c
static int ncsi_cmd_handler_ae(struct sk_buff *skb, struct ncsi_cmd_arg *nca) { struct ncsi_cmd_ae_pkt *cmd; cmd = skb_put_zero(skb, sizeof(*cmd)); cmd->mc_id = nca->bytes[0]; cmd->mode = htonl(nca->dwords[1]); ncsi_cmd_build_header(&cmd->cmd.common, nca); return 0; }
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-cmd.c
static int ncsi_cmd_handler_sl(struct sk_buff *skb, struct ncsi_cmd_arg *nca) { struct ncsi_cmd_sl_pkt *cmd; cmd = skb_put_zero(skb, sizeof(*cmd)); cmd->mode = htonl(nca->dwords[0]); cmd->oem_mode = htonl(nca->dwords[1]); ncsi_cmd_build_header(&cmd->cmd.common, nca); return 0; }
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-cmd.c
static int ncsi_cmd_handler_oem(struct sk_buff *skb, struct ncsi_cmd_arg *nca) { struct ncsi_cmd_oem_pkt *cmd; unsigned int len; int payload; payload = ALIGN(nca->payload, 4); len = sizeof(struct ncsi_cmd_pkt_hdr) + 4; len += max(payload, padding_bytes); cmd = skb_put_zero(skb, len); unsafe_memcpy(&cm...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-cmd.c
static struct ncsi_request *ncsi_alloc_command(struct ncsi_cmd_arg *nca) { struct ncsi_dev_priv *ndp = nca->ndp; struct ncsi_dev *nd = &ndp->ndev; struct net_device *dev = nd->dev; int hlen = LL_RESERVED_SPACE(dev); int tlen = dev->needed_tailroom; int payload; int len = hlen + tlen; struct sk_buff *skb...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp, struct ncsi_channel *channel) { struct ncsi_package *np; struct ncsi_channel *nc; NCSI_FOR_EACH_PACKAGE(ndp, np) NCSI_FOR_EACH_CHANNEL(np, nc) { if (nc == channel) continue; if (nc->state == NCSI_CHANNEL_ACTIVE && ncs...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
void ncsi_stop_channel_monitor(struct ncsi_channel *nc) { unsigned long flags; spin_lock_irqsave(&nc->lock, flags); if (!nc->monitor.enabled) { spin_unlock_irqrestore(&nc->lock, flags); return; } nc->monitor.enabled = false; spin_unlock_irqrestore(&nc->lock, flags); del_timer_sync(&nc->monitor....
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
static void ncsi_remove_channel(struct ncsi_channel *nc) { struct ncsi_package *np = nc->package; unsigned long flags; spin_lock_irqsave(&nc->lock, flags); kfree(nc->mac_filter.addrs); kfree(nc->vlan_filter.vids); nc->state = NCSI_CHANNEL_INACTIVE; spin_unlock_irqrestore(&nc->lock, flags); ncsi_stop_...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
void ncsi_remove_package(struct ncsi_package *np) { struct ncsi_dev_priv *ndp = np->ndp; struct ncsi_channel *nc, *tmp; unsigned long flags; list_for_each_entry_safe(nc, tmp, &np->channels, node) ncsi_remove_channel(nc); /* Remove and free package */ spin_lock_irqsave(&ndp->lock, flags); list_del_...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
void ncsi_free_request(struct ncsi_request *nr) { struct ncsi_dev_priv *ndp = nr->ndp; struct sk_buff *cmd, *rsp; unsigned long flags; bool driven; if (nr->enabled) { nr->enabled = false; del_timer_sync(&nr->timer); } spin_lock_irqsave(&ndp->lock, flags); cmd = nr->cmd; rsp = nr->rsp; nr->...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
struct ncsi_dev *ncsi_find_dev(struct net_device *dev) { struct ncsi_dev_priv *ndp; NCSI_FOR_EACH_DEV(ndp) { if (ndp->ndev.dev == dev) return &ndp->ndev; } return NULL; }
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
static int ncsi_oem_gma_handler_mlx(struct ncsi_cmd_arg *nca) { union { u8 data_u8[NCSI_OEM_MLX_CMD_GMA_LEN]; u32 data_u32[NCSI_OEM_MLX_CMD_GMA_LEN / sizeof(u32)]; } u; int ret = 0; nca->payload = NCSI_OEM_MLX_CMD_GMA_LEN; memset(&u, 0, sizeof(u)); u.data_u32[0] = ntohl((__force __be32)NCSI_OEM_M...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
static int ncsi_oem_smaf_mlx(struct ncsi_cmd_arg *nca) { union { u8 data_u8[NCSI_OEM_MLX_CMD_SMAF_LEN]; u32 data_u32[NCSI_OEM_MLX_CMD_SMAF_LEN / sizeof(u32)]; } u; int ret = 0; memset(&u, 0, sizeof(u)); u.data_u32[0] = ntohl((__force __be32)NCSI_OEM_MFR_MLX_ID); u.data_u8[5] = NCSI_OEM_MLX_CMD_SMA...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
static int ncsi_oem_gma_handler_intel(struct ncsi_cmd_arg *nca) { unsigned char data[NCSI_OEM_INTEL_CMD_GMA_LEN]; int ret = 0; nca->payload = NCSI_OEM_INTEL_CMD_GMA_LEN; memset(data, 0, NCSI_OEM_INTEL_CMD_GMA_LEN); *(unsigned int *)data = ntohl((__force __be32)NCSI_OEM_MFR_INTEL_ID); data[4] = NCSI_OEM_I...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
static bool ncsi_check_hwa(struct ncsi_dev_priv *ndp) { struct ncsi_package *np; struct ncsi_channel *nc; unsigned int cap; bool has_channel = false; NCSI_FOR_EACH_PACKAGE(ndp, np) { NCSI_FOR_EACH_CHANNEL(np, nc) { has_channel = true; cap = nc->caps[NCSI_CAP_GENERIC].cap; if (!(cap & N...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
static void ncsi_dev_work(struct work_struct *work) { struct ncsi_dev_priv *ndp = container_of(work, struct ncsi_dev_priv, work); struct ncsi_dev *nd = &ndp->ndev; switch (nd->state & ncsi_dev_state_major) { case ncsi_dev_state_probe: ncsi_probe_channel(ndp); break; case ncsi_dev_state_suspend: ...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
int ncsi_process_next_channel(struct ncsi_dev_priv *ndp) { struct ncsi_channel *nc; int old_state; unsigned long flags; spin_lock_irqsave(&ndp->lock, flags); nc = list_first_or_null_rcu(&ndp->channel_queue, struct ncsi_channel, link); if (!nc) { spin_unlock_irqrestore(&ndp->lock, flags); goto out;...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-manage.c
int ncsi_start_dev(struct ncsi_dev *nd) { struct ncsi_dev_priv *ndp = TO_NCSI_DEV_PRIV(nd); if (nd->state != ncsi_dev_state_registered && nd->state != ncsi_dev_state_functional) return -ENOTTY; if (!(ndp->flags & NCSI_DEV_PROBED)) { ndp->package_probe_id = 0; nd->state = ncsi_dev_state_probe;...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-netlink.c
static int ncsi_write_package_info(struct sk_buff *skb, struct ncsi_dev_priv *ndp, unsigned int id) { struct nlattr *pnest, *cnest, *nest; struct ncsi_package *np; struct ncsi_channel *nc; bool found; int rc; if (id > ndp->package_num - 1) { netdev_info(ndp->ndev.dev...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-netlink.c
int ncsi_send_netlink_err(struct net_device *dev, u32 snd_seq, u32 snd_portid, struct nlmsghdr *nlhdr, int err) { struct nlmsghdr *nlh; struct nlmsgerr *nle; struct sk_buff *skb; struct net *net; skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); if (!skb) return -ENOMEM; ne...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-netlink.c
static int __init ncsi_init_netlink(void) { return genl_register_family(&ncsi_genl_family); }
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_svf(struct ncsi_request *nr) { struct ncsi_cmd_svf_pkt *cmd; struct ncsi_rsp_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_vlan_filter *ncf; unsigned long flags; void *bitmap; rsp = (struct ncsi_rsp_pkt *)skb_network_header(nr->r...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_dv(struct ncsi_request *nr) { struct ncsi_rsp_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_mode *ncm; rsp = (struct ncsi_rsp_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rsp->rsp.common.channel, NULL, &nc); ...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_sma(struct ncsi_request *nr) { struct ncsi_cmd_sma_pkt *cmd; struct ncsi_rsp_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_mac_filter *ncf; unsigned long flags; void *bitmap; bool enabled; int index; rsp = (struct ncsi_rsp_pk...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_ebf(struct ncsi_request *nr) { struct ncsi_cmd_ebf_pkt *cmd; struct ncsi_rsp_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_mode *ncm; rsp = (struct ncsi_rsp_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rsp-...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_egmf(struct ncsi_request *nr) { struct ncsi_cmd_egmf_pkt *cmd; struct ncsi_rsp_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_mode *ncm; rsp = (struct ncsi_rsp_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rs...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_dgmf(struct ncsi_request *nr) { struct ncsi_rsp_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_mode *ncm; rsp = (struct ncsi_rsp_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rsp->rsp.common.channel, NULL, &nc)...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_oem_mlx(struct ncsi_request *nr) { struct ncsi_rsp_oem_mlx_pkt *mlx; struct ncsi_rsp_oem_pkt *rsp; rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp); mlx = (struct ncsi_rsp_oem_mlx_pkt *)(rsp->data); if (mlx->cmd == NCSI_OEM_MLX_CMD_GMA && mlx->param == NCSI_OEM_...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_oem_intel(struct ncsi_request *nr) { struct ncsi_rsp_oem_intel_pkt *intel; struct ncsi_rsp_oem_pkt *rsp; rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp); intel = (struct ncsi_rsp_oem_intel_pkt *)(rsp->data); if (intel->cmd == NCSI_OEM_INTEL_CMD_GMA) return ncsi_r...
[ 0, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_gvi(struct ncsi_request *nr) { struct ncsi_rsp_gvi_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; struct ncsi_channel_version *ncv; int i; rsp = (struct ncsi_rsp_gvi_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rsp->rsp.common....
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_gc(struct ncsi_request *nr) { struct ncsi_rsp_gc_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_channel *nc; size_t size; rsp = (struct ncsi_rsp_gc_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rsp->rsp.common.channel, NULL, &nc); if (!nc) ...
[ 1, 0 ]
Linux Kernel
net/ncsi/ncsi-rsp.c
static int ncsi_rsp_handler_gps(struct ncsi_request *nr) { struct ncsi_rsp_gps_pkt *rsp; struct ncsi_dev_priv *ndp = nr->ndp; struct ncsi_package *np; rsp = (struct ncsi_rsp_gps_pkt *)skb_network_header(nr->rsp); ncsi_find_package_and_channel(ndp, rsp->rsp.common.channel, &np, NULL); if (!np) return -E...
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
static struct nf_hook_entries *allocate_hook_entries_size(u16 num) { struct nf_hook_entries *e; size_t alloc = sizeof(*e) + sizeof(struct nf_hook_entry) * num + sizeof(struct nf_hook_ops *) * num + sizeof(struct nf_hook_entries_rcu_head); if (num == 0) return NULL; e = k...
[ 1, 0 ]
Linux Kernel
net/netfilter/core.c
static void hooks_validate(const struct nf_hook_entries *hooks) { #ifdef CONFIG_DEBUG_MISC struct nf_hook_ops **orig_ops; int prio = INT_MIN; size_t i = 0; orig_ops = nf_hook_entries_get_hook_ops(hooks); for (i = 0; i < hooks->num_hook_entries; i++) { if (orig_ops[i] == &dummy_ops) continue; ...
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
int nf_register_net_hook(struct net *net, const struct nf_hook_ops *reg) { int err; if (reg->pf == NFPROTO_INET) { if (reg->hooknum == NF_INET_INGRESS) { err = __nf_register_net_hook(net, NFPROTO_INET, reg); if (err < 0) return err; } else { err = __nf_register_net_hook(net, NFPR...
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
int nf_register_net_hooks(struct net *net, const struct nf_hook_ops *reg, unsigned int n) { unsigned int i; int err = 0; for (i = 0; i < n; i++) { err = nf_register_net_hook(net, &reg[i]); if (err) goto err; } return err; err: if (i > 0) nf_unregister_net_hooks...
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, const struct nf_hook_entries *e, unsigned int s) { unsigned int verdict; int ret; for (; s < e->num_hook_entries; s++) { verdict = nf_hook_entry_hookfn(&e->hooks[s], skb, state); switch (verdict & NF_VERDICT_MASK) { c...
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
void nf_conntrack_destroy(struct nf_conntrack *nfct) { const struct nf_ct_hook *ct_hook; rcu_read_lock(); ct_hook = rcu_dereference(nf_ct_hook); BUG_ON(ct_hook == NULL); ct_hook->destroy(nfct); rcu_read_unlock(); }
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple, const struct sk_buff *skb) { const struct nf_ct_hook *ct_hook; bool ret = false; rcu_read_lock(); ct_hook = rcu_dereference(nf_ct_hook); if (ct_hook) ret = ct_hook->get_tuple_skb(dst_tuple, skb); rcu_read_unlock();...
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
static void __net_init __netfilter_net_init(struct nf_hook_entries __rcu **e, int max) { int h; for (h = 0; h < max; h++) RCU_INIT_POINTER(e[h], NULL); }
[ 0, 0 ]
Linux Kernel
net/netfilter/core.c
static int __net_init netfilter_net_init(struct net *net) { __netfilter_net_init(net->nf.hooks_ipv4, ARRAY_SIZE(net->nf.hooks_ipv4)); __netfilter_net_init(net->nf.hooks_ipv6, ARRAY_SIZE(net->nf.hooks_ipv6)); #ifdef CONFIG_NETFILTER_FAMILY_ARP __netfilter_net_init(net->nf.hooks_arp, ARRAY_SIZE(net->nf.hooks_arp))...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_gen.h
static void mtype_destroy(struct ip_set *set) { struct mtype *map = set->data; if (SET_WITH_TIMEOUT(set)) del_timer_sync(&map->gc); if (set->dsize && set->extensions & IPSET_EXT_DESTROY) mtype_ext_cleanup(set); ip_set_free(map->members); ip_set_free(map); set->data = NULL; }
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_gen.h
static int mtype_head(struct ip_set *set, struct sk_buff *skb) { const struct mtype *map = set->data; struct nlattr *nested; size_t memsize = mtype_memsize(map, set->dsize) + set->ext_size; nested = nla_nest_start(skb, IPSET_ATTR_DATA); if (!nested) goto nla_put_failure; if (mtype_do_head(skb, map) ||...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_gen.h
static int mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext, struct ip_set_ext *mext, u32 flags) { struct mtype *map = set->data; const struct mtype_adt_elem *e = value; void *x = get_ext(set, map, e->id); int ret = mtype_do_add(e, map, flags, set...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ip.c
static int bitmap_ip_do_test(const struct bitmap_ip_adt_elem *e, struct bitmap_ip *map, size_t dsize) { return !!test_bit(e->id, map->members); }
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ip.c
static int bitmap_ip_do_add(const struct bitmap_ip_adt_elem *e, struct bitmap_ip *map, u32 flags, size_t dsize) { return !!test_bit(e->id, map->members); }
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ip.c
static int bitmap_ip_do_head(struct sk_buff *skb, const struct bitmap_ip *map) { return nla_put_ipaddr4(skb, IPSET_ATTR_IP, htonl(map->first_ip)) || nla_put_ipaddr4(skb, IPSET_ATTR_IP_TO, htonl(map->last_ip)) || (map->netmask != 32 && nla_put_u8(skb, IPSET_ATTR_NETMASK, map->netmask)); }
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ip.c
static bool init_map_ip(struct ip_set *set, struct bitmap_ip *map, u32 first_ip, u32 last_ip, u32 elements, u32 hosts, u8 netmask) { map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN); if (!map->members) return false; map->first_ip = first_ip; map->last_ip = last_ip; ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ipmac.c
static int bitmap_ipmac_gc_test(u16 id, const struct bitmap_ipmac *map, size_t dsize) { const struct bitmap_ipmac_elem *elem; if (!test_bit(id, map->members)) return 0; elem = get_const_elem(map->extensions, id, dsize); return elem->filled == MAC_FILLED; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ipmac.c
static int bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb, const struct xt_action_param *par, enum ipset_adt adt, struct ip_set_adt_opt *opt) { struct bitmap_ipmac *map = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct bitmap...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_ipmac.c
static bool init_map_ipmac(struct ip_set *set, struct bitmap_ipmac *map, u32 first_ip, u32 last_ip, u32 elements) { map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN); if (!map->members) return false; map->first_ip = first_ip; map->last_ip = last_ip; map->elements...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_port.c
static int bitmap_port_do_del(const struct bitmap_port_adt_elem *e, struct bitmap_port *map) { return !test_and_clear_bit(e->id, map->members); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_port.c
static int bitmap_port_do_list(struct sk_buff *skb, const struct bitmap_port *map, u32 id, size_t dsize) { return nla_put_net16(skb, IPSET_ATTR_PORT, htons(map->first_port + id)); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_port.c
static bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port) { bool ret; u8 proto; switch (pf) { case NFPROTO_IPV4: ret = ip_set_get_ip4_port(skb, src, port, &proto); break; case NFPROTO_IPV6: ret = ip_set_get_ip6_port(skb, src, port, &p...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_bitmap_port.c
static int bitmap_port_uadt(struct ip_set *set, struct nlattr *tb[], enum ipset_adt adt, u32 *lineno, u32 flags, bool retried) { struct bitmap_port *map = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct bitmap_port_adt_elem e = {.id = 0}; str...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static struct ip_set_net *ip_set_pernet(struct net *net) { return net_generic(net, ip_set_net_id); } #define IP_SET_INC 64
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static void ip_set_type_unlock(void) { mutex_unlock(&ip_set_type_mutex); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static struct ip_set_type *find_set_type(const char *name, u8 family, u8 revision) { struct ip_set_type *type; list_for_each_entry_rcu( type, &ip_set_type_list, list, lockdep_is_held( &ip_set_type_mutex)) if (STRNCMP(type->name, name) && ...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static bool load_settype(const char *name) { nfnl_unlock(NFNL_SUBSYS_IPSET); pr_debug("try to load ip_set_%s\n", name); if (request_module("ip_set_%s", name) < 0) { pr_warn("Can't find ip_set type %s\n", name); nfnl_lock(NFNL_SUBSYS_IPSET); return false; } nfnl_lock(NFNL_SUBSYS_IPSET); return tr...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int __find_set_type_get(const char *name, u8 family, u8 revision, struct ip_set_type **found, bool retry) { struct ip_set_type *type; int err; if (retry && !load_settype(name)) return -IPSET_ERR_FIND_TYPE; rcu_read_lock(); *found = find_set_type(name, family, revisi...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
void ip_set_type_unregister(struct ip_set_type *type) { ip_set_type_lock(); if (!find_set_type(type->name, type->family, type->revision_min)) { pr_warn("ip_set type %s, family %s with revision min %u not registered\n", type->name, family_name(type->family), type->revision_min); ip_set_type_unloc...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
void ip_set_free(void *members) { pr_debug("%p: free with %s\n", members, is_vmalloc_addr(members) ? "vfree" : "kfree"); kvfree(members); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static u32 ip_set_timeout_get(const unsigned long *timeout) { u32 t; if (*timeout == IPSET_ELEM_PERMANENT) return 0; t = jiffies_to_msecs(*timeout - jiffies) / MSEC_PER_SEC; return t == 0 ? 1 : t; }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static void ip_set_comment_free(struct ip_set *set, void *ptr) { struct ip_set_comment *comment = ptr; struct ip_set_comment_rcu *c; c = rcu_dereference_protected(comment->c, 1); if (unlikely(!c)) return; set->ext_size -= sizeof(*c) + strlen(c->str) + 1; kfree_rcu(c, rcu); rcu_assign_pointer(comment-...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
int ip_set_put_extensions(struct sk_buff *skb, const struct ip_set *set, const void *e, bool active) { if (SET_WITH_TIMEOUT(set)) { unsigned long *timeout = ext_timeout(e, set); if (nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(active ? ip_set_timeout_get(timeo...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static void __ip_set_put_netlink(struct ip_set *set) { write_lock_bh(&ip_set_ref_lock); BUG_ON(set->ref_netlink == 0); set->ref_netlink--; write_unlock_bh(&ip_set_ref_lock); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
int ip_set_test(ip_set_id_t index, const struct sk_buff *skb, const struct xt_action_param *par, struct ip_set_adt_opt *opt) { struct ip_set *set = ip_set_rcu_get(xt_net(par), index); int ret = 0; BUG_ON(!set); pr_debug("set %s, index %u\n", set->name, index); if (opt->dim < set->type->dimen...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
void ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name) { struct ip_set *set = ip_set_rcu_get(net, index); BUG_ON(!set); read_lock_bh(&ip_set_ref_lock); strncpy(name, set->name, IPSET_MAXNAMELEN); read_unlock_bh(&ip_set_ref_lock); }
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static inline bool protocol_failed(const struct nlattr *const tb[]) { return !tb[IPSET_ATTR_PROTOCOL] || protocol(tb) != IPSET_PROTOCOL; }
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static inline struct ip_set *find_set(struct ip_set_net *inst, const char *name) { ip_set_id_t id; return find_set_and_id(inst, name, &id); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int find_free_id(struct ip_set_net *inst, const char *name, ip_set_id_t *index, struct ip_set **set) { struct ip_set *s; ip_set_id_t i; *index = IPSET_INVALID_ID; for (i = 0; i < inst->ip_set_max; i++) { s = ip_set(inst, i); if (!s) { if (*index == IPSET_INVALID_ID)...
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static void ip_set_flush_set(struct ip_set *set) { pr_debug("set: %s\n", set->name); ip_set_lock(set); set->variant->flush(set); ip_set_unlock(set); }
[ 0, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_rename(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const attr[]) { struct ip_set_net *inst = ip_set_pernet(info->net); struct ip_set *set, *s; const char *name2; ip_set_id_t i; int ret = 0; if (unlikely(protocol_min_failed(attr) || !at...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_swap(struct sk_buff *skb, const struct nfnl_info *info, const struct nlattr *const attr[]) { struct ip_set_net *inst = ip_set_pernet(info->net); struct ip_set *from, *to; ip_set_id_t from_id, to_id; char from_name[IPSET_MAXNAMELEN]; if (unlikely(protocol_min_failed(at...
[ 1, 0 ]
Linux Kernel
net/netfilter/ipset/ip_set_core.c
static int ip_set_dump_done(struct netlink_callback *cb) { if (cb->args[IPSET_CB_ARG0]) { struct ip_set_net *inst = (struct ip_set_net *)cb->args[IPSET_CB_NET]; ip_set_id_t index = (ip_set_id_t)cb->args[IPSET_CB_INDEX]; struct ip_set *set = ip_set_ref_netlink(inst, index); if (set->variant->uref) ...
[ 0, 0 ]