* [PATCH 11/13 RFC net-next] net: cipso: guard IPv4 packet manipulation functions [not found] <20260712013941.4570-1-fmancera@suse.de> @ 2026-07-12 1:39 ` Fernando Fernandez Mancera 2026-07-12 16:22 ` Paul Moore 0 siblings, 1 reply; 3+ messages in thread From: Fernando Fernandez Mancera @ 2026-07-12 1:39 UTC (permalink / raw) To: netdev Cc: davem, edumazet, kuba, pabeni, dsahern, horms, idosch, Fernando Fernandez Mancera, Paul Moore, linux-security-module, linux-kernel To enable compiling the network stack without IPv4, the CIPSO functions that manipulate IPv4 options and generate ICMP errors must be bypassed. Ideally, CIPSO should not be compiled when IPv4 is disabled but currently it is too integrated within netlabel, so let's just bypassed the relevant functions. Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> --- net/ipv4/cipso_ipv4.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index a05aa075de1a..17bb723299d7 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c @@ -1714,6 +1714,7 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option) */ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway) { +#if IS_ENABLED(CONFIG_IPV4) struct inet_skb_parm parm; int res; @@ -1738,6 +1739,7 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway) __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, &parm); else __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, &parm); +#endif } /** @@ -2171,6 +2173,7 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { +#if IS_ENABLED(CONFIG_IPV4) int ret_val; struct iphdr *iph; struct ip_options *opt = &IPCB(skb)->opt; @@ -2235,6 +2238,9 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb, ip_send_check(iph); return 0; +#else + return -EOPNOTSUPP; +#endif } /** @@ -2248,6 +2254,7 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb, */ int cipso_v4_skbuff_delattr(struct sk_buff *skb) { +#if IS_ENABLED(CONFIG_IPV4) int ret_val, cipso_len, hdr_len_actual, new_hdr_len_actual, new_hdr_len, hdr_len_delta; struct iphdr *iph; @@ -2296,6 +2303,9 @@ int cipso_v4_skbuff_delattr(struct sk_buff *skb) ip_send_check(iph); return 0; +#else + return -EOPNOTSUPP; +#endif } /* -- 2.54.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 11/13 RFC net-next] net: cipso: guard IPv4 packet manipulation functions 2026-07-12 1:39 ` [PATCH 11/13 RFC net-next] net: cipso: guard IPv4 packet manipulation functions Fernando Fernandez Mancera @ 2026-07-12 16:22 ` Paul Moore 2026-07-13 14:03 ` Fernando Fernandez Mancera 0 siblings, 1 reply; 3+ messages in thread From: Paul Moore @ 2026-07-12 16:22 UTC (permalink / raw) To: Fernando Fernandez Mancera Cc: netdev, davem, edumazet, kuba, pabeni, dsahern, horms, idosch, linux-security-module, linux-kernel On Sat, Jul 11, 2026 at 9:41 PM Fernando Fernandez Mancera <fmancera@suse.de> wrote: > > To enable compiling the network stack without IPv4, the CIPSO functions > that manipulate IPv4 options and generate ICMP errors must be bypassed. > > Ideally, CIPSO should not be compiled when IPv4 is disabled but > currently it is too integrated within netlabel, so let's just bypassed > the relevant functions. > > Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> > --- > net/ipv4/cipso_ipv4.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) I think I would prefer to make CONFIG_NETLABEL dependent on CONFIG_IPV4 at this point in time. This will keep the code cleaner and allow time to do the proper work of wrapping the CIPSO code with CONFIG_CIPSO (or similar) and making that dependent on CONFIG_IPV4. -- paul-moore.com ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 11/13 RFC net-next] net: cipso: guard IPv4 packet manipulation functions 2026-07-12 16:22 ` Paul Moore @ 2026-07-13 14:03 ` Fernando Fernandez Mancera 0 siblings, 0 replies; 3+ messages in thread From: Fernando Fernandez Mancera @ 2026-07-13 14:03 UTC (permalink / raw) To: Paul Moore Cc: netdev, davem, edumazet, kuba, pabeni, dsahern, horms, idosch, linux-security-module, linux-kernel On 7/12/26 6:22 PM, Paul Moore wrote: > On Sat, Jul 11, 2026 at 9:41 PM Fernando Fernandez Mancera > <fmancera@suse.de> wrote: >> >> To enable compiling the network stack without IPv4, the CIPSO functions >> that manipulate IPv4 options and generate ICMP errors must be bypassed. >> >> Ideally, CIPSO should not be compiled when IPv4 is disabled but >> currently it is too integrated within netlabel, so let's just bypassed >> the relevant functions. >> >> Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> >> --- >> net/ipv4/cipso_ipv4.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) > > I think I would prefer to make CONFIG_NETLABEL dependent on > CONFIG_IPV4 at this point in time. This will keep the code cleaner > and allow time to do the proper work of wrapping the CIPSO code with > CONFIG_CIPSO (or similar) and making that dependent on CONFIG_IPV4. > Fair, that works for me too. I am gonna drop this on the v1. Thank you! Fernando. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-13 14:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260712013941.4570-1-fmancera@suse.de>
2026-07-12 1:39 ` [PATCH 11/13 RFC net-next] net: cipso: guard IPv4 packet manipulation functions Fernando Fernandez Mancera
2026-07-12 16:22 ` Paul Moore
2026-07-13 14:03 ` Fernando Fernandez Mancera
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox