Skip to content

Commit bd1d97d

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== Netfilter updates for net-next The following patchset contains Netfilter updates for net-next, mostly rather small housekeeping patches: 1) Remove unused variable in IPVS, from GuoYong Zheng. 2) Use memset_after in conntrack, from Kees Cook. 3) Remove leftover function in nfnetlink_queue, from Florian Westphal. 4) Remove redundant test on bool in conntrack, from Bernard Zhao. 5) egress support for nft_fwd, from Lukas Wunner. 6) Make pppoe work for br_netfilter, from Florian Westphal. 7) Remove unused variable in conntrack resize routine, from luo penghao. * git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next: netfilter: conntrack: Remove useless assignment statements netfilter: bridge: add support for pppoe filtering netfilter: nft_fwd_netdev: Support egress hook netfilter: ctnetlink: remove useless type conversion to bool netfilter: nf_queue: remove leftover synchronize_rcu netfilter: conntrack: Use memset_startat() to zero struct nf_conn ipvs: remove unused variable for ip_vs_new_dest ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 3bc14ea + 284ca76 commit bd1d97d

File tree

6 files changed

+12
-22
lines changed

6 files changed

+12
-22
lines changed

net/bridge/br_netfilter_hooks.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
743743
if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu)
744744
mtu = nf_bridge->frag_max_size;
745745

746+
nf_bridge_update_protocol(skb);
747+
nf_bridge_push_encap_header(skb);
748+
746749
if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) {
747750
nf_bridge_info_free(skb);
748751
return br_dev_queue_push_xmit(net, sk, skb);
@@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
760763

761764
IPCB(skb)->frag_max_size = nf_bridge->frag_max_size;
762765

763-
nf_bridge_update_protocol(skb);
764-
765766
data = this_cpu_ptr(&brnf_frag_data_storage);
766767

767768
if (skb_vlan_tag_present(skb)) {
@@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
789790

790791
IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size;
791792

792-
nf_bridge_update_protocol(skb);
793-
794793
data = this_cpu_ptr(&brnf_frag_data_storage);
795794
data->encap_size = nf_bridge_encap_header_len(skb);
796795
data->size = ETH_HLEN + data->encap_size;

net/netfilter/ipvs/ip_vs_ctl.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest,
960960
* Create a destination for the given service
961961
*/
962962
static int
963-
ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
964-
struct ip_vs_dest **dest_p)
963+
ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
965964
{
966965
struct ip_vs_dest *dest;
967966
unsigned int atype, i;
@@ -1021,8 +1020,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
10211020
spin_lock_init(&dest->stats.lock);
10221021
__ip_vs_update_dest(svc, dest, udest, 1);
10231022

1024-
*dest_p = dest;
1025-
10261023
LeaveFunction(2);
10271024
return 0;
10281025

@@ -1096,7 +1093,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
10961093
/*
10971094
* Allocate and initialize the dest structure
10981095
*/
1099-
ret = ip_vs_new_dest(svc, udest, &dest);
1096+
ret = ip_vs_new_dest(svc, udest);
11001097
}
11011098
LeaveFunction(2);
11021099

net/netfilter/nf_conntrack_core.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,9 +1562,7 @@ __nf_conntrack_alloc(struct net *net,
15621562
ct->status = 0;
15631563
WRITE_ONCE(ct->timeout, 0);
15641564
write_pnet(&ct->ct_net, net);
1565-
memset(&ct->__nfct_init_offset, 0,
1566-
offsetof(struct nf_conn, proto) -
1567-
offsetof(struct nf_conn, __nfct_init_offset));
1565+
memset_after(ct, 0, __nfct_init_offset);
15681566

15691567
nf_ct_zone_add(ct, zone);
15701568

@@ -2590,7 +2588,6 @@ int nf_conntrack_hash_resize(unsigned int hashsize)
25902588
hlist_nulls_add_head_rcu(&h->hnnode, &hash[bucket]);
25912589
}
25922590
}
2593-
old_size = nf_conntrack_htable_size;
25942591
old_hash = nf_conntrack_hash;
25952592

25962593
nf_conntrack_hash = hash;

net/netfilter/nf_conntrack_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying
17461746
res = ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).portid,
17471747
cb->nlh->nlmsg_seq,
17481748
NFNL_MSG_TYPE(cb->nlh->nlmsg_type),
1749-
ct, dying ? true : false, 0);
1749+
ct, dying, 0);
17501750
if (res < 0) {
17511751
if (!atomic_inc_not_zero(&ct->ct_general.use))
17521752
continue;

net/netfilter/nfnetlink_queue.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,15 +1527,9 @@ static void __net_exit nfnl_queue_net_exit(struct net *net)
15271527
WARN_ON_ONCE(!hlist_empty(&q->instance_table[i]));
15281528
}
15291529

1530-
static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list)
1531-
{
1532-
synchronize_rcu();
1533-
}
1534-
15351530
static struct pernet_operations nfnl_queue_net_ops = {
15361531
.init = nfnl_queue_net_init,
15371532
.exit = nfnl_queue_net_exit,
1538-
.exit_batch = nfnl_queue_net_exit_batch,
15391533
.id = &nfnl_queue_net_id,
15401534
.size = sizeof(struct nfnl_queue_net),
15411535
};

net/netfilter/nft_fwd_netdev.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ static void nft_fwd_netdev_eval(const struct nft_expr *expr,
2727
{
2828
struct nft_fwd_netdev *priv = nft_expr_priv(expr);
2929
int oif = regs->data[priv->sreg_dev];
30+
struct sk_buff *skb = pkt->skb;
3031

3132
/* This is used by ifb only. */
32-
skb_set_redirected(pkt->skb, true);
33+
skb->skb_iif = skb->dev->ifindex;
34+
skb_set_redirected(skb, nft_hook(pkt) == NF_NETDEV_INGRESS);
3335

3436
nf_fwd_netdev_egress(pkt, oif);
3537
regs->verdict.code = NF_STOLEN;
@@ -198,7 +200,8 @@ static int nft_fwd_validate(const struct nft_ctx *ctx,
198200
const struct nft_expr *expr,
199201
const struct nft_data **data)
200202
{
201-
return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS));
203+
return nft_chain_validate_hooks(ctx->chain, (1 << NF_NETDEV_INGRESS) |
204+
(1 << NF_NETDEV_EGRESS));
202205
}
203206

204207
static struct nft_expr_type nft_fwd_netdev_type;

0 commit comments

Comments
 (0)