Loading net/netfilter/nfnetlink_log.c +35 −52 Original line number Original line Diff line number Diff line Loading @@ -389,32 +389,27 @@ __build_packet_message(struct nfulnl_instance *inst, NLA_PUT(inst->skb, NFULA_PREFIX, plen, prefix); NLA_PUT(inst->skb, NFULA_PREFIX, plen, prefix); if (indev) { if (indev) { tmp_uint = htonl(indev->ifindex); #ifndef CONFIG_BRIDGE_NETFILTER #ifndef CONFIG_BRIDGE_NETFILTER NLA_PUT(inst->skb, NFULA_IFINDEX_INDEV, sizeof(tmp_uint), NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_INDEV, &tmp_uint); htonl(indev->ifindex)); #else #else if (pf == PF_BRIDGE) { if (pf == PF_BRIDGE) { /* Case 1: outdev is physical input device, we need to /* Case 1: outdev is physical input device, we need to * look for bridge group (when called from * look for bridge group (when called from * netfilter_bridge) */ * netfilter_bridge) */ NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSINDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSINDEV, sizeof(tmp_uint), &tmp_uint); htonl(indev->ifindex)); /* this is the bridge group "brX" */ /* this is the bridge group "brX" */ tmp_uint = htonl(indev->br_port->br->dev->ifindex); NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_INDEV, NLA_PUT(inst->skb, NFULA_IFINDEX_INDEV, htonl(indev->br_port->br->dev->ifindex)); sizeof(tmp_uint), &tmp_uint); } else { } else { /* Case 2: indev is bridge group, we need to look for /* Case 2: indev is bridge group, we need to look for * physical device (when called from ipv4) */ * physical device (when called from ipv4) */ NLA_PUT(inst->skb, NFULA_IFINDEX_INDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_INDEV, sizeof(tmp_uint), &tmp_uint); htonl(indev->ifindex)); if (skb->nf_bridge && skb->nf_bridge->physindev) { if (skb->nf_bridge && skb->nf_bridge->physindev) tmp_uint = NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSINDEV, htonl(skb->nf_bridge->physindev->ifindex); htonl(skb->nf_bridge->physindev->ifindex)); NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSINDEV, sizeof(tmp_uint), &tmp_uint); } } } #endif #endif } } Loading @@ -422,38 +417,32 @@ __build_packet_message(struct nfulnl_instance *inst, if (outdev) { if (outdev) { tmp_uint = htonl(outdev->ifindex); tmp_uint = htonl(outdev->ifindex); #ifndef CONFIG_BRIDGE_NETFILTER #ifndef CONFIG_BRIDGE_NETFILTER NLA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, sizeof(tmp_uint), NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_OUTDEV, &tmp_uint); htonl(outdev->ifindex)); #else #else if (pf == PF_BRIDGE) { if (pf == PF_BRIDGE) { /* Case 1: outdev is physical output device, we need to /* Case 1: outdev is physical output device, we need to * look for bridge group (when called from * look for bridge group (when called from * netfilter_bridge) */ * netfilter_bridge) */ NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, sizeof(tmp_uint), &tmp_uint); htonl(outdev->ifindex)); /* this is the bridge group "brX" */ /* this is the bridge group "brX" */ tmp_uint = htonl(outdev->br_port->br->dev->ifindex); NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_OUTDEV, NLA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, htonl(outdev->br_port->br->dev->ifindex)); sizeof(tmp_uint), &tmp_uint); } else { } else { /* Case 2: indev is a bridge group, we need to look /* Case 2: indev is a bridge group, we need to look * for physical device (when called from ipv4) */ * for physical device (when called from ipv4) */ NLA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_OUTDEV, sizeof(tmp_uint), &tmp_uint); htonl(outdev->ifindex)); if (skb->nf_bridge && skb->nf_bridge->physoutdev) { if (skb->nf_bridge && skb->nf_bridge->physoutdev) tmp_uint = NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, htonl(skb->nf_bridge->physoutdev->ifindex); htonl(skb->nf_bridge->physoutdev->ifindex)); NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, sizeof(tmp_uint), &tmp_uint); } } } #endif #endif } } if (skb->mark) { if (skb->mark) tmp_uint = htonl(skb->mark); NLA_PUT_BE32(inst->skb, NFULA_MARK, htonl(skb->mark)); NLA_PUT(inst->skb, NFULA_MARK, sizeof(tmp_uint), &tmp_uint); } if (indev && skb->dev) { if (indev && skb->dev) { struct nfulnl_msg_packet_hw phw; struct nfulnl_msg_packet_hw phw; Loading @@ -480,21 +469,19 @@ __build_packet_message(struct nfulnl_instance *inst, __be32 uid = htonl(skb->sk->sk_socket->file->f_uid); __be32 uid = htonl(skb->sk->sk_socket->file->f_uid); /* need to unlock here since NLA_PUT may goto */ /* need to unlock here since NLA_PUT may goto */ read_unlock_bh(&skb->sk->sk_callback_lock); read_unlock_bh(&skb->sk->sk_callback_lock); NLA_PUT(inst->skb, NFULA_UID, sizeof(uid), &uid); NLA_PUT_BE32(inst->skb, NFULA_UID, uid); } else } else read_unlock_bh(&skb->sk->sk_callback_lock); read_unlock_bh(&skb->sk->sk_callback_lock); } } /* local sequence number */ /* local sequence number */ if (inst->flags & NFULNL_CFG_F_SEQ) { if (inst->flags & NFULNL_CFG_F_SEQ) tmp_uint = htonl(inst->seq++); NLA_PUT_BE32(inst->skb, NFULA_SEQ, htonl(inst->seq++)); NLA_PUT(inst->skb, NFULA_SEQ, sizeof(tmp_uint), &tmp_uint); } /* global sequence number */ /* global sequence number */ if (inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) { if (inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) tmp_uint = htonl(atomic_inc_return(&global_seq)); NLA_PUT_BE32(inst->skb, NFULA_SEQ_GLOBAL, NLA_PUT(inst->skb, NFULA_SEQ_GLOBAL, sizeof(tmp_uint), &tmp_uint); htonl(atomic_inc_return(&global_seq))); } if (data_len) { if (data_len) { struct nlattr *nla; struct nlattr *nla; Loading Loading @@ -775,8 +762,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_TIMEOUT]) { if (nfula[NFULA_CFG_TIMEOUT]) { __be32 timeout = __be32 timeout = nla_get_be32(nfula[NFULA_CFG_TIMEOUT]); *(__be32 *)nla_data(nfula[NFULA_CFG_TIMEOUT]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading @@ -786,8 +772,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_NLBUFSIZ]) { if (nfula[NFULA_CFG_NLBUFSIZ]) { __be32 nlbufsiz = __be32 nlbufsiz = nla_get_be32(nfula[NFULA_CFG_NLBUFSIZ]); *(__be32 *)nla_data(nfula[NFULA_CFG_NLBUFSIZ]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading @@ -797,8 +782,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_QTHRESH]) { if (nfula[NFULA_CFG_QTHRESH]) { __be32 qthresh = __be32 qthresh = nla_get_be32(nfula[NFULA_CFG_QTHRESH]); *(__be32 *)nla_data(nfula[NFULA_CFG_QTHRESH]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading @@ -808,8 +792,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_FLAGS]) { if (nfula[NFULA_CFG_FLAGS]) { __be16 flags = __be16 flags = nla_get_be16(nfula[NFULA_CFG_FLAGS]); *(__be16 *)nla_data(nfula[NFULA_CFG_FLAGS]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading Loading
net/netfilter/nfnetlink_log.c +35 −52 Original line number Original line Diff line number Diff line Loading @@ -389,32 +389,27 @@ __build_packet_message(struct nfulnl_instance *inst, NLA_PUT(inst->skb, NFULA_PREFIX, plen, prefix); NLA_PUT(inst->skb, NFULA_PREFIX, plen, prefix); if (indev) { if (indev) { tmp_uint = htonl(indev->ifindex); #ifndef CONFIG_BRIDGE_NETFILTER #ifndef CONFIG_BRIDGE_NETFILTER NLA_PUT(inst->skb, NFULA_IFINDEX_INDEV, sizeof(tmp_uint), NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_INDEV, &tmp_uint); htonl(indev->ifindex)); #else #else if (pf == PF_BRIDGE) { if (pf == PF_BRIDGE) { /* Case 1: outdev is physical input device, we need to /* Case 1: outdev is physical input device, we need to * look for bridge group (when called from * look for bridge group (when called from * netfilter_bridge) */ * netfilter_bridge) */ NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSINDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSINDEV, sizeof(tmp_uint), &tmp_uint); htonl(indev->ifindex)); /* this is the bridge group "brX" */ /* this is the bridge group "brX" */ tmp_uint = htonl(indev->br_port->br->dev->ifindex); NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_INDEV, NLA_PUT(inst->skb, NFULA_IFINDEX_INDEV, htonl(indev->br_port->br->dev->ifindex)); sizeof(tmp_uint), &tmp_uint); } else { } else { /* Case 2: indev is bridge group, we need to look for /* Case 2: indev is bridge group, we need to look for * physical device (when called from ipv4) */ * physical device (when called from ipv4) */ NLA_PUT(inst->skb, NFULA_IFINDEX_INDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_INDEV, sizeof(tmp_uint), &tmp_uint); htonl(indev->ifindex)); if (skb->nf_bridge && skb->nf_bridge->physindev) { if (skb->nf_bridge && skb->nf_bridge->physindev) tmp_uint = NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSINDEV, htonl(skb->nf_bridge->physindev->ifindex); htonl(skb->nf_bridge->physindev->ifindex)); NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSINDEV, sizeof(tmp_uint), &tmp_uint); } } } #endif #endif } } Loading @@ -422,38 +417,32 @@ __build_packet_message(struct nfulnl_instance *inst, if (outdev) { if (outdev) { tmp_uint = htonl(outdev->ifindex); tmp_uint = htonl(outdev->ifindex); #ifndef CONFIG_BRIDGE_NETFILTER #ifndef CONFIG_BRIDGE_NETFILTER NLA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, sizeof(tmp_uint), NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_OUTDEV, &tmp_uint); htonl(outdev->ifindex)); #else #else if (pf == PF_BRIDGE) { if (pf == PF_BRIDGE) { /* Case 1: outdev is physical output device, we need to /* Case 1: outdev is physical output device, we need to * look for bridge group (when called from * look for bridge group (when called from * netfilter_bridge) */ * netfilter_bridge) */ NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, sizeof(tmp_uint), &tmp_uint); htonl(outdev->ifindex)); /* this is the bridge group "brX" */ /* this is the bridge group "brX" */ tmp_uint = htonl(outdev->br_port->br->dev->ifindex); NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_OUTDEV, NLA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, htonl(outdev->br_port->br->dev->ifindex)); sizeof(tmp_uint), &tmp_uint); } else { } else { /* Case 2: indev is a bridge group, we need to look /* Case 2: indev is a bridge group, we need to look * for physical device (when called from ipv4) */ * for physical device (when called from ipv4) */ NLA_PUT(inst->skb, NFULA_IFINDEX_OUTDEV, NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_OUTDEV, sizeof(tmp_uint), &tmp_uint); htonl(outdev->ifindex)); if (skb->nf_bridge && skb->nf_bridge->physoutdev) { if (skb->nf_bridge && skb->nf_bridge->physoutdev) tmp_uint = NLA_PUT_BE32(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, htonl(skb->nf_bridge->physoutdev->ifindex); htonl(skb->nf_bridge->physoutdev->ifindex)); NLA_PUT(inst->skb, NFULA_IFINDEX_PHYSOUTDEV, sizeof(tmp_uint), &tmp_uint); } } } #endif #endif } } if (skb->mark) { if (skb->mark) tmp_uint = htonl(skb->mark); NLA_PUT_BE32(inst->skb, NFULA_MARK, htonl(skb->mark)); NLA_PUT(inst->skb, NFULA_MARK, sizeof(tmp_uint), &tmp_uint); } if (indev && skb->dev) { if (indev && skb->dev) { struct nfulnl_msg_packet_hw phw; struct nfulnl_msg_packet_hw phw; Loading @@ -480,21 +469,19 @@ __build_packet_message(struct nfulnl_instance *inst, __be32 uid = htonl(skb->sk->sk_socket->file->f_uid); __be32 uid = htonl(skb->sk->sk_socket->file->f_uid); /* need to unlock here since NLA_PUT may goto */ /* need to unlock here since NLA_PUT may goto */ read_unlock_bh(&skb->sk->sk_callback_lock); read_unlock_bh(&skb->sk->sk_callback_lock); NLA_PUT(inst->skb, NFULA_UID, sizeof(uid), &uid); NLA_PUT_BE32(inst->skb, NFULA_UID, uid); } else } else read_unlock_bh(&skb->sk->sk_callback_lock); read_unlock_bh(&skb->sk->sk_callback_lock); } } /* local sequence number */ /* local sequence number */ if (inst->flags & NFULNL_CFG_F_SEQ) { if (inst->flags & NFULNL_CFG_F_SEQ) tmp_uint = htonl(inst->seq++); NLA_PUT_BE32(inst->skb, NFULA_SEQ, htonl(inst->seq++)); NLA_PUT(inst->skb, NFULA_SEQ, sizeof(tmp_uint), &tmp_uint); } /* global sequence number */ /* global sequence number */ if (inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) { if (inst->flags & NFULNL_CFG_F_SEQ_GLOBAL) tmp_uint = htonl(atomic_inc_return(&global_seq)); NLA_PUT_BE32(inst->skb, NFULA_SEQ_GLOBAL, NLA_PUT(inst->skb, NFULA_SEQ_GLOBAL, sizeof(tmp_uint), &tmp_uint); htonl(atomic_inc_return(&global_seq))); } if (data_len) { if (data_len) { struct nlattr *nla; struct nlattr *nla; Loading Loading @@ -775,8 +762,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_TIMEOUT]) { if (nfula[NFULA_CFG_TIMEOUT]) { __be32 timeout = __be32 timeout = nla_get_be32(nfula[NFULA_CFG_TIMEOUT]); *(__be32 *)nla_data(nfula[NFULA_CFG_TIMEOUT]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading @@ -786,8 +772,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_NLBUFSIZ]) { if (nfula[NFULA_CFG_NLBUFSIZ]) { __be32 nlbufsiz = __be32 nlbufsiz = nla_get_be32(nfula[NFULA_CFG_NLBUFSIZ]); *(__be32 *)nla_data(nfula[NFULA_CFG_NLBUFSIZ]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading @@ -797,8 +782,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_QTHRESH]) { if (nfula[NFULA_CFG_QTHRESH]) { __be32 qthresh = __be32 qthresh = nla_get_be32(nfula[NFULA_CFG_QTHRESH]); *(__be32 *)nla_data(nfula[NFULA_CFG_QTHRESH]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading @@ -808,8 +792,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, } } if (nfula[NFULA_CFG_FLAGS]) { if (nfula[NFULA_CFG_FLAGS]) { __be16 flags = __be16 flags = nla_get_be16(nfula[NFULA_CFG_FLAGS]); *(__be16 *)nla_data(nfula[NFULA_CFG_FLAGS]); if (!inst) { if (!inst) { ret = -ENODEV; ret = -ENODEV; Loading