Skip to content

Commit aab3634

Browse files
committed
Enable EFI debug kernel build variable
PR URL: https://www.github.com/delphix/linux-kernel-generic/pull/46
1 parent 436f4ae commit aab3634

File tree

6 files changed

+410
-241
lines changed

6 files changed

+410
-241
lines changed

debian.master/config/annotations

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,7 +3806,7 @@ CONFIG_DEBUG_CGROUP_REF policy<{'amd64': 'n', 'arm64': '
38063806
CONFIG_DEBUG_CLOSURES policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 'riscv64': 'n', 's390x': 'n'}>
38073807
CONFIG_DEBUG_DEVRES policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 'riscv64': 'n', 's390x': 'n'}>
38083808
CONFIG_DEBUG_DRIVER policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 'riscv64': 'n', 's390x': 'n'}>
3809-
CONFIG_DEBUG_EFI policy<{'arm64': 'n'}>
3809+
CONFIG_DEBUG_EFI policy<{'amd64': 'y', 'arm64': 'n'}>
38103810
CONFIG_DEBUG_ENTRY policy<{'amd64': 'n', 's390x': 'n'}>
38113811
CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B policy<{'amd64': 'n', 'arm64': 'n', 'ppc64el': 'n', 'riscv64': 'n', 's390x': 'n'}>
38123812
CONFIG_DEBUG_FORCE_WEAK_PER_CPU policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n', 'riscv64': 'n', 's390x': 'n'}>
@@ -4758,7 +4758,7 @@ CONFIG_EFI_SECRET policy<{'amd64': 'm'}>
47584758
CONFIG_EFI_SOFT_RESERVE policy<{'amd64': 'y', 'arm64': 'y'}>
47594759
CONFIG_EFI_STUB policy<{'amd64': 'y', 'arm64': 'y', 'armhf': 'y', 'riscv64': 'y'}>
47604760
CONFIG_EFI_TEST policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'riscv64': 'm'}>
4761-
CONFIG_EFI_VARS_PSTORE policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'riscv64': 'm'}>
4761+
CONFIG_EFI_VARS_PSTORE policy<{'amd64': 'y', 'arm64': 'm', 'armhf': 'm', 'riscv64': 'm'}>
47624762
CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE policy<{'amd64': 'n', 'arm64': 'n', 'armhf': 'n', 'riscv64': 'n'}>
47634763
CONFIG_EFS_FS policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm', 's390x': 'n'}>
47644764
CONFIG_EINT_MTK policy<{'arm64': 'y', 'armhf': 'y'}>
Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,7 @@
1-
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2-
/* Copyright (C) 2002,2004 MARA Systems AB <https://www.marasystems.com>
3-
* by Henrik Nordstrom <[email protected]>
4-
*/
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef _XT_CONNMARK_H_target
3+
#define _XT_CONNMARK_H_target
54

6-
#ifndef _XT_CONNMARK_H
7-
#define _XT_CONNMARK_H
5+
#include <linux/netfilter/xt_connmark.h>
86

9-
#include <linux/types.h>
10-
11-
enum {
12-
XT_CONNMARK_SET = 0,
13-
XT_CONNMARK_SAVE,
14-
XT_CONNMARK_RESTORE
15-
};
16-
17-
enum {
18-
D_SHIFT_LEFT = 0,
19-
D_SHIFT_RIGHT,
20-
};
21-
22-
struct xt_connmark_tginfo1 {
23-
__u32 ctmark, ctmask, nfmask;
24-
__u8 mode;
25-
};
26-
27-
struct xt_connmark_tginfo2 {
28-
__u32 ctmark, ctmask, nfmask;
29-
__u8 shift_dir, shift_bits, mode;
30-
};
31-
32-
struct xt_connmark_mtinfo1 {
33-
__u32 mark, mask;
34-
__u8 invert;
35-
};
36-
37-
#endif /*_XT_CONNMARK_H*/
7+
#endif /*_XT_CONNMARK_H_target*/

net/netfilter/xt_dscp.c

Lines changed: 100 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// SPDX-License-Identifier: GPL-2.0-only
2-
/* IP tables module for matching the value of the IPv4/IPv6 DSCP field
2+
/* x_tables module for setting the IPv4/IPv6 DSCP field, Version 1.8
33
*
44
* (C) 2002 by Harald Welte <[email protected]>
5-
*/
5+
* based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <[email protected]>
6+
*
7+
* See RFC2474 for a description of the DSCP field within the IP Header.
8+
*/
69
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
710
#include <linux/module.h>
811
#include <linux/skbuff.h>
@@ -11,100 +14,148 @@
1114
#include <net/dsfield.h>
1215

1316
#include <linux/netfilter/x_tables.h>
14-
#include <linux/netfilter/xt_dscp.h>
17+
#include <linux/netfilter/xt_DSCP.h>
1518

1619
MODULE_AUTHOR("Harald Welte <[email protected]>");
17-
MODULE_DESCRIPTION("Xtables: DSCP/TOS field match");
20+
MODULE_DESCRIPTION("Xtables: DSCP/TOS field modification");
1821
MODULE_LICENSE("GPL");
19-
MODULE_ALIAS("ipt_dscp");
20-
MODULE_ALIAS("ip6t_dscp");
21-
MODULE_ALIAS("ipt_tos");
22-
MODULE_ALIAS("ip6t_tos");
22+
MODULE_ALIAS("ipt_DSCP");
23+
MODULE_ALIAS("ip6t_DSCP");
24+
MODULE_ALIAS("ipt_TOS");
25+
MODULE_ALIAS("ip6t_TOS");
26+
27+
#define XT_DSCP_ECN_MASK 3u
2328

24-
static bool
25-
dscp_mt(const struct sk_buff *skb, struct xt_action_param *par)
29+
static unsigned int
30+
dscp_tg(struct sk_buff *skb, const struct xt_action_param *par)
2631
{
27-
const struct xt_dscp_info *info = par->matchinfo;
32+
const struct xt_DSCP_info *dinfo = par->targinfo;
2833
u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
2934

30-
return (dscp == info->dscp) ^ !!info->invert;
35+
if (dscp != dinfo->dscp) {
36+
if (skb_ensure_writable(skb, sizeof(struct iphdr)))
37+
return NF_DROP;
38+
39+
ipv4_change_dsfield(ip_hdr(skb), XT_DSCP_ECN_MASK,
40+
dinfo->dscp << XT_DSCP_SHIFT);
41+
42+
}
43+
return XT_CONTINUE;
3144
}
3245

33-
static bool
34-
dscp_mt6(const struct sk_buff *skb, struct xt_action_param *par)
46+
static unsigned int
47+
dscp_tg6(struct sk_buff *skb, const struct xt_action_param *par)
3548
{
36-
const struct xt_dscp_info *info = par->matchinfo;
49+
const struct xt_DSCP_info *dinfo = par->targinfo;
3750
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
3851

39-
return (dscp == info->dscp) ^ !!info->invert;
52+
if (dscp != dinfo->dscp) {
53+
if (skb_ensure_writable(skb, sizeof(struct ipv6hdr)))
54+
return NF_DROP;
55+
56+
ipv6_change_dsfield(ipv6_hdr(skb), XT_DSCP_ECN_MASK,
57+
dinfo->dscp << XT_DSCP_SHIFT);
58+
}
59+
return XT_CONTINUE;
4060
}
4161

42-
static int dscp_mt_check(const struct xt_mtchk_param *par)
62+
static int dscp_tg_check(const struct xt_tgchk_param *par)
4363
{
44-
const struct xt_dscp_info *info = par->matchinfo;
64+
const struct xt_DSCP_info *info = par->targinfo;
4565

4666
if (info->dscp > XT_DSCP_MAX)
4767
return -EDOM;
48-
4968
return 0;
5069
}
5170

52-
static bool tos_mt(const struct sk_buff *skb, struct xt_action_param *par)
71+
static unsigned int
72+
tos_tg(struct sk_buff *skb, const struct xt_action_param *par)
5373
{
54-
const struct xt_tos_match_info *info = par->matchinfo;
55-
56-
if (xt_family(par) == NFPROTO_IPV4)
57-
return ((ip_hdr(skb)->tos & info->tos_mask) ==
58-
info->tos_value) ^ !!info->invert;
59-
else
60-
return ((ipv6_get_dsfield(ipv6_hdr(skb)) & info->tos_mask) ==
61-
info->tos_value) ^ !!info->invert;
74+
const struct xt_tos_target_info *info = par->targinfo;
75+
struct iphdr *iph = ip_hdr(skb);
76+
u_int8_t orig, nv;
77+
78+
orig = ipv4_get_dsfield(iph);
79+
nv = (orig & ~info->tos_mask) ^ info->tos_value;
80+
81+
if (orig != nv) {
82+
if (skb_ensure_writable(skb, sizeof(struct iphdr)))
83+
return NF_DROP;
84+
iph = ip_hdr(skb);
85+
ipv4_change_dsfield(iph, 0, nv);
86+
}
87+
88+
return XT_CONTINUE;
89+
}
90+
91+
static unsigned int
92+
tos_tg6(struct sk_buff *skb, const struct xt_action_param *par)
93+
{
94+
const struct xt_tos_target_info *info = par->targinfo;
95+
struct ipv6hdr *iph = ipv6_hdr(skb);
96+
u_int8_t orig, nv;
97+
98+
orig = ipv6_get_dsfield(iph);
99+
nv = (orig & ~info->tos_mask) ^ info->tos_value;
100+
101+
if (orig != nv) {
102+
if (skb_ensure_writable(skb, sizeof(struct iphdr)))
103+
return NF_DROP;
104+
iph = ipv6_hdr(skb);
105+
ipv6_change_dsfield(iph, 0, nv);
106+
}
107+
108+
return XT_CONTINUE;
62109
}
63110

64-
static struct xt_match dscp_mt_reg[] __read_mostly = {
111+
static struct xt_target dscp_tg_reg[] __read_mostly = {
65112
{
66-
.name = "dscp",
113+
.name = "DSCP",
67114
.family = NFPROTO_IPV4,
68-
.checkentry = dscp_mt_check,
69-
.match = dscp_mt,
70-
.matchsize = sizeof(struct xt_dscp_info),
115+
.checkentry = dscp_tg_check,
116+
.target = dscp_tg,
117+
.targetsize = sizeof(struct xt_DSCP_info),
118+
.table = "mangle",
71119
.me = THIS_MODULE,
72120
},
73121
{
74-
.name = "dscp",
122+
.name = "DSCP",
75123
.family = NFPROTO_IPV6,
76-
.checkentry = dscp_mt_check,
77-
.match = dscp_mt6,
78-
.matchsize = sizeof(struct xt_dscp_info),
124+
.checkentry = dscp_tg_check,
125+
.target = dscp_tg6,
126+
.targetsize = sizeof(struct xt_DSCP_info),
127+
.table = "mangle",
79128
.me = THIS_MODULE,
80129
},
81130
{
82-
.name = "tos",
131+
.name = "TOS",
83132
.revision = 1,
84133
.family = NFPROTO_IPV4,
85-
.match = tos_mt,
86-
.matchsize = sizeof(struct xt_tos_match_info),
134+
.table = "mangle",
135+
.target = tos_tg,
136+
.targetsize = sizeof(struct xt_tos_target_info),
87137
.me = THIS_MODULE,
88138
},
89139
{
90-
.name = "tos",
140+
.name = "TOS",
91141
.revision = 1,
92142
.family = NFPROTO_IPV6,
93-
.match = tos_mt,
94-
.matchsize = sizeof(struct xt_tos_match_info),
143+
.table = "mangle",
144+
.target = tos_tg6,
145+
.targetsize = sizeof(struct xt_tos_target_info),
95146
.me = THIS_MODULE,
96147
},
97148
};
98149

99-
static int __init dscp_mt_init(void)
150+
static int __init dscp_tg_init(void)
100151
{
101-
return xt_register_matches(dscp_mt_reg, ARRAY_SIZE(dscp_mt_reg));
152+
return xt_register_targets(dscp_tg_reg, ARRAY_SIZE(dscp_tg_reg));
102153
}
103154

104-
static void __exit dscp_mt_exit(void)
155+
static void __exit dscp_tg_exit(void)
105156
{
106-
xt_unregister_matches(dscp_mt_reg, ARRAY_SIZE(dscp_mt_reg));
157+
xt_unregister_targets(dscp_tg_reg, ARRAY_SIZE(dscp_tg_reg));
107158
}
108159

109-
module_init(dscp_mt_init);
110-
module_exit(dscp_mt_exit);
160+
module_init(dscp_tg_init);
161+
module_exit(dscp_tg_exit);

0 commit comments

Comments
 (0)