* [PATCH 3/7] secid reconciliation-v02: Invoke LSM hook for inbound traffic
@ 2006-09-08 16:50 Venkat Yekkirala
2006-09-18 18:05 ` James Morris
0 siblings, 1 reply; 2+ messages in thread
From: Venkat Yekkirala @ 2006-09-08 16:50 UTC (permalink / raw)
To: netdev, selinux; +Cc: jmorris, sds, chanson
Invoke the skb_policy_check LSM hook for inbound (INPUT/FORWARD)
traffic for secid reconciliation and flow control.
Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
---
include/net/xfrm.h | 50 +++++++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 23 deletions(-)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index bf8e2df..7b020bd 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -663,22 +663,20 @@ extern int __xfrm_policy_check(struct so
static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family)
{
- if (sk && sk->sk_policy[XFRM_POLICY_IN])
- return __xfrm_policy_check(sk, dir, skb, family);
-
- return (!xfrm_policy_count[dir] && !skb->sp) ||
- (skb->dst->flags & DST_NOPOLICY) ||
- __xfrm_policy_check(sk, dir, skb, family);
-}
-
-static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb)
-{
- return xfrm_policy_check(sk, dir, skb, AF_INET);
-}
+ int ret;
-static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb)
-{
- return xfrm_policy_check(sk, dir, skb, AF_INET6);
+ if (sk && sk->sk_policy[XFRM_POLICY_IN])
+ ret = __xfrm_policy_check(sk, dir, skb, family);
+ else
+ ret = (!xfrm_policy_count[dir] && !skb->sp) ||
+ (skb->dst->flags & DST_NOPOLICY) ||
+ __xfrm_policy_check(sk, dir, skb, family);
+
+#ifdef CONFIG_SECURITY_NETWORK
+ if (ret)
+ ret = security_skb_policy_check(skb, family);
+#endif /* CONFIG_SECURITY_NETWORK */
+ return ret;
}
extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family);
@@ -730,20 +728,26 @@ static inline void xfrm_sk_free_policy(s
static inline int xfrm_sk_clone_policy(struct sock *sk) { return 0; }
static inline int xfrm6_route_forward(struct sk_buff *skb) { return 1; }
static inline int xfrm4_route_forward(struct sk_buff *skb) { return 1; }
-static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb)
-{
- return 1;
-}
-static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb)
-{
- return 1;
-}
static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family)
{
+#ifdef CONFIG_SECURITY_NETWORK
+ return security_skb_policy_check(skb, family);
+#else
return 1;
+#endif /* CONFIG_SECURITY_NETWORK */
}
#endif
+static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb)
+{
+ return xfrm_policy_check(sk, dir, skb, AF_INET);
+}
+
+static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *skb)
+{
+ return xfrm_policy_check(sk, dir, skb, AF_INET6);
+}
+
static __inline__
xfrm_address_t *xfrm_flowi_daddr(struct flowi *fl, unsigned short family)
{
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 3/7] secid reconciliation-v02: Invoke LSM hook for inbound traffic
2006-09-08 16:50 [PATCH 3/7] secid reconciliation-v02: Invoke LSM hook for inbound traffic Venkat Yekkirala
@ 2006-09-18 18:05 ` James Morris
0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2006-09-18 18:05 UTC (permalink / raw)
To: Venkat Yekkirala; +Cc: netdev, selinux, sds, chanson
On Fri, 8 Sep 2006, Venkat Yekkirala wrote:
> -static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff
> *skb)
> -{
> - return xfrm_policy_check(sk, dir, skb, AF_INET6);
> + if (sk && sk->sk_policy[XFRM_POLICY_IN])
> + ret = __xfrm_policy_check(sk, dir, skb, family);
> + else
> + ret = (!xfrm_policy_count[dir] && !skb->sp) ||
> + (skb->dst->flags & DST_NOPOLICY) ||
> + __xfrm_policy_check(sk, dir, skb, family);
> +
> +#ifdef CONFIG_SECURITY_NETWORK
> + if (ret)
> + ret = security_skb_policy_check(skb, family);
> +#endif /* CONFIG_SECURITY_NETWORK */
Why is this code ifdef'd when the function is conditionally compiled?
> {
> +#ifdef CONFIG_SECURITY_NETWORK
> + return security_skb_policy_check(skb, family);
> +#else
> return 1;
> +#endif /* CONFIG_SECURITY_NETWORK */
Ditto.
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-18 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-08 16:50 [PATCH 3/7] secid reconciliation-v02: Invoke LSM hook for inbound traffic Venkat Yekkirala
2006-09-18 18:05 ` James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).