mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 02:43:24 +03:00
fb79113a00
This is dumb... These are all android/google/qualcomm/asus "features" added to the kernel with no concern about actually being compatible with the kernel. They all assume no USER_NS stuff. Fun!
655 lines
23 KiB
Diff
655 lines
23 KiB
Diff
From 10ce33b7e705444925a85014319fd9959f586bc4 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
|
|
Date: Wed, 9 Oct 2019 20:46:09 -0400
|
|
Subject: [PATCH] Revert "Handle 'sk' being NULL in UID-based routing."
|
|
|
|
This reverts commit ba2261dc1bedf87f853def25db65df3f8977a14b.
|
|
|
|
Revert "net: core: Support UID-based routing."
|
|
|
|
This reverts commit 588de68efbffe9698deac0c8ee5cfd7a3f348be2.
|
|
---
|
|
include/net/fib_rules.h | 6 +---
|
|
include/net/flow.h | 8 +----
|
|
include/net/ip.h | 1 -
|
|
include/net/route.h | 6 ++--
|
|
include/uapi/linux/fib_rules.h | 2 --
|
|
include/uapi/linux/rtnetlink.h | 1 -
|
|
net/core/fib_rules.c | 59 +-------------------------------
|
|
net/ipv4/fib_frontend.c | 1 -
|
|
net/ipv4/inet_connection_sock.c | 6 ++--
|
|
net/ipv4/ip_output.c | 3 +-
|
|
net/ipv4/ping.c | 3 +-
|
|
net/ipv4/raw.c | 3 +-
|
|
net/ipv4/route.c | 23 ++++---------
|
|
net/ipv4/syncookies.c | 3 +-
|
|
net/ipv4/udp.c | 3 +-
|
|
net/ipv4/xfrm4_policy.c | 1 -
|
|
net/ipv6/af_inet6.c | 1 -
|
|
net/ipv6/datagram.c | 1 -
|
|
net/ipv6/inet6_connection_sock.c | 1 -
|
|
net/ipv6/ping.c | 1 -
|
|
net/ipv6/raw.c | 1 -
|
|
net/ipv6/route.c | 6 ----
|
|
net/ipv6/syncookies.c | 1 -
|
|
net/ipv6/tcp_ipv6.c | 1 -
|
|
net/ipv6/udp.c | 1 -
|
|
25 files changed, 18 insertions(+), 125 deletions(-)
|
|
|
|
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
|
|
index 3a4c37d9fb0..e361f488242 100644
|
|
--- a/include/net/fib_rules.h
|
|
+++ b/include/net/fib_rules.h
|
|
@@ -23,8 +23,6 @@ struct fib_rule {
|
|
struct fib_rule __rcu *ctarget;
|
|
char iifname[IFNAMSIZ];
|
|
char oifname[IFNAMSIZ];
|
|
- uid_t uid_start;
|
|
- uid_t uid_end;
|
|
struct rcu_head rcu;
|
|
struct net * fr_net;
|
|
};
|
|
@@ -82,9 +80,7 @@ struct fib_rules_ops {
|
|
[FRA_FWMARK] = { .type = NLA_U32 }, \
|
|
[FRA_FWMASK] = { .type = NLA_U32 }, \
|
|
[FRA_TABLE] = { .type = NLA_U32 }, \
|
|
- [FRA_GOTO] = { .type = NLA_U32 }, \
|
|
- [FRA_UID_START] = { .type = NLA_U32 }, \
|
|
- [FRA_UID_END] = { .type = NLA_U32 }
|
|
+ [FRA_GOTO] = { .type = NLA_U32 }
|
|
|
|
static inline void fib_rule_get(struct fib_rule *rule)
|
|
{
|
|
diff --git a/include/net/flow.h b/include/net/flow.h
|
|
index c3679f972fd..0eb5516a4ca 100644
|
|
--- a/include/net/flow.h
|
|
+++ b/include/net/flow.h
|
|
@@ -31,7 +31,6 @@ struct flowi_common {
|
|
#define FLOWI_FLAG_CAN_SLEEP 0x02
|
|
#define FLOWI_FLAG_KNOWN_NH 0x04
|
|
__u32 flowic_secid;
|
|
- uid_t flowic_uid;
|
|
};
|
|
|
|
union flowi_uli {
|
|
@@ -68,7 +67,6 @@ struct flowi4 {
|
|
#define flowi4_proto __fl_common.flowic_proto
|
|
#define flowi4_flags __fl_common.flowic_flags
|
|
#define flowi4_secid __fl_common.flowic_secid
|
|
-#define flowi4_uid __fl_common.flowic_uid
|
|
|
|
/* (saddr,daddr) must be grouped, same order as in IP header */
|
|
__be32 saddr;
|
|
@@ -88,8 +86,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
|
|
__u32 mark, __u8 tos, __u8 scope,
|
|
__u8 proto, __u8 flags,
|
|
__be32 daddr, __be32 saddr,
|
|
- __be16 dport, __be16 sport,
|
|
- uid_t uid)
|
|
+ __be16 dport, __be16 sport)
|
|
{
|
|
fl4->flowi4_oif = oif;
|
|
fl4->flowi4_iif = LOOPBACK_IFINDEX;
|
|
@@ -99,7 +96,6 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
|
|
fl4->flowi4_proto = proto;
|
|
fl4->flowi4_flags = flags;
|
|
fl4->flowi4_secid = 0;
|
|
- fl4->flowi4_uid = uid;
|
|
fl4->daddr = daddr;
|
|
fl4->saddr = saddr;
|
|
fl4->fl4_dport = dport;
|
|
@@ -127,7 +123,6 @@ struct flowi6 {
|
|
#define flowi6_proto __fl_common.flowic_proto
|
|
#define flowi6_flags __fl_common.flowic_flags
|
|
#define flowi6_secid __fl_common.flowic_secid
|
|
-#define flowi6_uid __fl_common.flowic_uid
|
|
struct in6_addr daddr;
|
|
struct in6_addr saddr;
|
|
__be32 flowlabel;
|
|
@@ -171,7 +166,6 @@ struct flowi {
|
|
#define flowi_proto u.__fl_common.flowic_proto
|
|
#define flowi_flags u.__fl_common.flowic_flags
|
|
#define flowi_secid u.__fl_common.flowic_secid
|
|
-#define flowi_uid u.__fl_common.flowic_uid
|
|
} __attribute__((__aligned__(BITS_PER_LONG/8)));
|
|
|
|
static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)
|
|
diff --git a/include/net/ip.h b/include/net/ip.h
|
|
index 80da4e188d4..2e5194a2302 100644
|
|
--- a/include/net/ip.h
|
|
+++ b/include/net/ip.h
|
|
@@ -155,7 +155,6 @@ struct ip_reply_arg {
|
|
/* -1 if not needed */
|
|
int bound_dev_if;
|
|
u8 tos;
|
|
- uid_t uid;
|
|
};
|
|
|
|
#define IP_REPLY_ARG_NOSRCCHECK 1
|
|
diff --git a/include/net/route.h b/include/net/route.h
|
|
index 43280f6fa56..2ea40c1b5e0 100644
|
|
--- a/include/net/route.h
|
|
+++ b/include/net/route.h
|
|
@@ -52,7 +52,6 @@ struct rtable {
|
|
__u8 rt_uses_gateway;
|
|
|
|
int rt_iif;
|
|
- uid_t rt_uid;
|
|
|
|
/* Info on neighbour */
|
|
__be32 rt_gateway;
|
|
@@ -143,7 +142,7 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct flowi
|
|
flowi4_init_output(fl4, oif, sk ? sk->sk_mark : 0, tos,
|
|
RT_SCOPE_UNIVERSE, proto,
|
|
sk ? inet_sk_flowi_flags(sk) : 0,
|
|
- daddr, saddr, dport, sport, sk ? sock_i_uid(sk) : 0);
|
|
+ daddr, saddr, dport, sport);
|
|
if (sk)
|
|
security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
|
|
return ip_route_output_flow(net, fl4, sk);
|
|
@@ -254,8 +253,7 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32
|
|
flow_flags |= FLOWI_FLAG_CAN_SLEEP;
|
|
|
|
flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE,
|
|
- protocol, flow_flags, dst, src, dport, sport,
|
|
- sock_i_uid(sk));
|
|
+ protocol, flow_flags, dst, src, dport, sport);
|
|
}
|
|
|
|
static inline struct rtable *ip_route_connect(struct flowi4 *fl4,
|
|
diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h
|
|
index 9dcdb6251cb..51da65b68b8 100644
|
|
--- a/include/uapi/linux/fib_rules.h
|
|
+++ b/include/uapi/linux/fib_rules.h
|
|
@@ -49,8 +49,6 @@ enum {
|
|
FRA_TABLE, /* Extended table id */
|
|
FRA_FWMASK, /* mask for netfilter mark */
|
|
FRA_OIFNAME,
|
|
- FRA_UID_START, /* UID range */
|
|
- FRA_UID_END,
|
|
__FRA_MAX
|
|
};
|
|
|
|
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
|
|
index b1a99e18b70..7a2144e1afa 100644
|
|
--- a/include/uapi/linux/rtnetlink.h
|
|
+++ b/include/uapi/linux/rtnetlink.h
|
|
@@ -296,7 +296,6 @@ enum rtattr_type_t {
|
|
RTA_MP_ALGO, /* no longer used */
|
|
RTA_TABLE,
|
|
RTA_MARK,
|
|
- RTA_UID,
|
|
RTA_MFC_STATS,
|
|
__RTA_MAX
|
|
};
|
|
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
|
|
index fb9adc5d193..84340a2605e 100644
|
|
--- a/net/core/fib_rules.c
|
|
+++ b/net/core/fib_rules.c
|
|
@@ -17,11 +17,6 @@
|
|
#include <net/sock.h>
|
|
#include <net/fib_rules.h>
|
|
|
|
-#define uid_valid(uid) ((uid) != -1)
|
|
-#define uid_lte(a, b) ((a) <= (b))
|
|
-#define uid_eq(a, b) ((a) == (b))
|
|
-#define uid_gte(a, b) ((a) >= (b))
|
|
-
|
|
int fib_default_rule_add(struct fib_rules_ops *ops,
|
|
u32 pref, u32 table, u32 flags)
|
|
{
|
|
@@ -36,8 +31,6 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
|
|
r->pref = pref;
|
|
r->table = table;
|
|
r->flags = flags;
|
|
- r->uid_start = INVALID_UID;
|
|
- r->uid_end = INVALID_UID;
|
|
r->fr_net = hold_net(ops->fro_net);
|
|
|
|
/* The lock is not required here, the list in unreacheable
|
|
@@ -186,23 +179,6 @@ void fib_rules_unregister(struct fib_rules_ops *ops)
|
|
}
|
|
EXPORT_SYMBOL_GPL(fib_rules_unregister);
|
|
|
|
-static inline uid_t fib_nl_uid(struct nlattr *nla)
|
|
-{
|
|
- return nla_get_u32(nla);
|
|
-}
|
|
-
|
|
-static int nla_put_uid(struct sk_buff *skb, int idx, uid_t uid)
|
|
-{
|
|
- return nla_put_u32(skb, idx, uid);
|
|
-}
|
|
-
|
|
-static int fib_uid_range_match(struct flowi *fl, struct fib_rule *rule)
|
|
-{
|
|
- return (!uid_valid(rule->uid_start) && !uid_valid(rule->uid_end)) ||
|
|
- (uid_gte(fl->flowi_uid, rule->uid_start) &&
|
|
- uid_lte(fl->flowi_uid, rule->uid_end));
|
|
-}
|
|
-
|
|
static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
|
|
struct flowi *fl, int flags)
|
|
{
|
|
@@ -217,9 +193,6 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
|
|
if ((rule->mark ^ fl->flowi_mark) & rule->mark_mask)
|
|
goto out;
|
|
|
|
- if (!fib_uid_range_match(fl, rule))
|
|
- goto out;
|
|
-
|
|
ret = ops->match(rule, fl, flags);
|
|
out:
|
|
return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
|
|
@@ -390,19 +363,6 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh)
|
|
} else if (rule->action == FR_ACT_GOTO)
|
|
goto errout_free;
|
|
|
|
- /* UID start and end must either both be valid or both unspecified. */
|
|
- rule->uid_start = rule->uid_end = INVALID_UID;
|
|
- if (tb[FRA_UID_START] || tb[FRA_UID_END]) {
|
|
- if (tb[FRA_UID_START] && tb[FRA_UID_END]) {
|
|
- rule->uid_start = fib_nl_uid(tb[FRA_UID_START]);
|
|
- rule->uid_end = fib_nl_uid(tb[FRA_UID_END]);
|
|
- }
|
|
- if (!uid_valid(rule->uid_start) ||
|
|
- !uid_valid(rule->uid_end) ||
|
|
- !uid_lte(rule->uid_start, rule->uid_end))
|
|
- goto errout_free;
|
|
- }
|
|
-
|
|
err = ops->configure(rule, skb, frh, tb);
|
|
if (err < 0)
|
|
goto errout_free;
|
|
@@ -509,14 +469,6 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh)
|
|
(rule->mark_mask != nla_get_u32(tb[FRA_FWMASK])))
|
|
continue;
|
|
|
|
- if (tb[FRA_UID_START] &&
|
|
- !uid_eq(rule->uid_start, fib_nl_uid(tb[FRA_UID_START])))
|
|
- continue;
|
|
-
|
|
- if (tb[FRA_UID_END] &&
|
|
- !uid_eq(rule->uid_end, fib_nl_uid(tb[FRA_UID_END])))
|
|
- continue;
|
|
-
|
|
if (!ops->compare(rule, frh, tb))
|
|
continue;
|
|
|
|
@@ -573,9 +525,7 @@ static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
|
|
+ nla_total_size(4) /* FRA_PRIORITY */
|
|
+ nla_total_size(4) /* FRA_TABLE */
|
|
+ nla_total_size(4) /* FRA_FWMARK */
|
|
- + nla_total_size(4) /* FRA_FWMASK */
|
|
- + nla_total_size(4) /* FRA_UID_START */
|
|
- + nla_total_size(4); /* FRA_UID_END */
|
|
+ + nla_total_size(4); /* FRA_FWMASK */
|
|
|
|
if (ops->nlmsg_payload)
|
|
payload += ops->nlmsg_payload(rule);
|
|
@@ -631,13 +581,6 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
|
|
(rule->target &&
|
|
nla_put_u32(skb, FRA_GOTO, rule->target)))
|
|
goto nla_put_failure;
|
|
-
|
|
- if (uid_valid(rule->uid_start))
|
|
- nla_put_uid(skb, FRA_UID_START, rule->uid_start);
|
|
-
|
|
- if (uid_valid(rule->uid_end))
|
|
- nla_put_uid(skb, FRA_UID_END, rule->uid_end);
|
|
-
|
|
if (ops->fill(rule, skb, frh) < 0)
|
|
goto nla_put_failure;
|
|
|
|
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
|
|
index 3f991296301..9bac2e954b9 100644
|
|
--- a/net/ipv4/fib_frontend.c
|
|
+++ b/net/ipv4/fib_frontend.c
|
|
@@ -531,7 +531,6 @@ const struct nla_policy rtm_ipv4_policy[RTA_MAX + 1] = {
|
|
[RTA_METRICS] = { .type = NLA_NESTED },
|
|
[RTA_MULTIPATH] = { .len = sizeof(struct rtnexthop) },
|
|
[RTA_FLOW] = { .type = NLA_U32 },
|
|
- [RTA_UID] = { .type = NLA_U32 },
|
|
};
|
|
|
|
static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
|
|
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
|
|
index ca872fec1db..07905f79996 100644
|
|
--- a/net/ipv4/inet_connection_sock.c
|
|
+++ b/net/ipv4/inet_connection_sock.c
|
|
@@ -422,8 +422,7 @@ struct dst_entry *inet_csk_route_req(struct sock *sk,
|
|
sk->sk_protocol,
|
|
flags,
|
|
(opt && opt->opt.srr) ? opt->opt.faddr : ireq->rmt_addr,
|
|
- ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport,
|
|
- sock_i_uid(sk));
|
|
+ ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport);
|
|
security_req_classify_flow(req, flowi4_to_flowi(fl4));
|
|
rt = ip_route_output_flow(net, fl4, sk);
|
|
if (IS_ERR(rt))
|
|
@@ -459,8 +458,7 @@ struct dst_entry *inet_csk_route_child_sock(struct sock *sk,
|
|
RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
|
|
sk->sk_protocol, inet_sk_flowi_flags(sk),
|
|
(opt && opt->opt.srr) ? opt->opt.faddr : ireq->rmt_addr,
|
|
- ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport,
|
|
- sock_i_uid(sk));
|
|
+ ireq->loc_addr, ireq->rmt_port, inet_sk(sk)->inet_sport);
|
|
security_req_classify_flow(req, flowi4_to_flowi(fl4));
|
|
rt = ip_route_output_flow(net, fl4, sk);
|
|
if (IS_ERR(rt))
|
|
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
|
|
index 1204570dcce..a15b080130a 100644
|
|
--- a/net/ipv4/ip_output.c
|
|
+++ b/net/ipv4/ip_output.c
|
|
@@ -1494,8 +1494,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr,
|
|
RT_SCOPE_UNIVERSE, ip_hdr(skb)->protocol,
|
|
ip_reply_arg_flowi_flags(arg),
|
|
daddr, saddr,
|
|
- tcp_hdr(skb)->source, tcp_hdr(skb)->dest,
|
|
- arg->uid);
|
|
+ tcp_hdr(skb)->source, tcp_hdr(skb)->dest);
|
|
security_skb_classify_flow(skb, flowi4_to_flowi(&fl4));
|
|
rt = ip_route_output_key(net, &fl4);
|
|
if (IS_ERR(rt))
|
|
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
|
|
index 86ee6cf6fe9..f05594b2ff4 100644
|
|
--- a/net/ipv4/ping.c
|
|
+++ b/net/ipv4/ping.c
|
|
@@ -789,8 +789,7 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|
|
|
flowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,
|
|
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
|
- inet_sk_flowi_flags(sk), faddr, saddr, 0, 0,
|
|
- sock_i_uid(sk));
|
|
+ inet_sk_flowi_flags(sk), faddr, saddr, 0, 0);
|
|
|
|
security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
|
|
rt = ip_route_output_flow(net, &fl4, sk);
|
|
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
|
|
index b9c87c8c0b1..b4a1c42a627 100644
|
|
--- a/net/ipv4/raw.c
|
|
+++ b/net/ipv4/raw.c
|
|
@@ -573,8 +573,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|
inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,
|
|
inet_sk_flowi_flags(sk) | FLOWI_FLAG_CAN_SLEEP |
|
|
(inet->hdrincl ? FLOWI_FLAG_KNOWN_NH : 0),
|
|
- daddr, saddr, 0, 0,
|
|
- sock_i_uid(sk));
|
|
+ daddr, saddr, 0, 0);
|
|
|
|
if (!inet->hdrincl) {
|
|
err = raw_probe_proto_opt(&fl4, msg);
|
|
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
|
|
index 3283060a8cc..fe162ac7ecc 100644
|
|
--- a/net/ipv4/route.c
|
|
+++ b/net/ipv4/route.c
|
|
@@ -515,7 +515,7 @@ void __ip_select_ident(struct iphdr *iph, int segs)
|
|
}
|
|
EXPORT_SYMBOL(__ip_select_ident);
|
|
|
|
-static void __build_flow_key(struct flowi4 *fl4, struct sock *sk,
|
|
+static void __build_flow_key(struct flowi4 *fl4, const struct sock *sk,
|
|
const struct iphdr *iph,
|
|
int oif, u8 tos,
|
|
u8 prot, u32 mark, int flow_flags)
|
|
@@ -531,12 +531,11 @@ static void __build_flow_key(struct flowi4 *fl4, struct sock *sk,
|
|
flowi4_init_output(fl4, oif, mark, tos,
|
|
RT_SCOPE_UNIVERSE, prot,
|
|
flow_flags,
|
|
- iph->daddr, iph->saddr, 0, 0,
|
|
- sk ? sock_i_uid(sk) : 0);
|
|
+ iph->daddr, iph->saddr, 0, 0);
|
|
}
|
|
|
|
static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb,
|
|
- struct sock *sk)
|
|
+ const struct sock *sk)
|
|
{
|
|
const struct iphdr *iph = ip_hdr(skb);
|
|
int oif = skb->dev->ifindex;
|
|
@@ -547,7 +546,7 @@ static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb,
|
|
__build_flow_key(fl4, sk, iph, oif, tos, prot, mark, 0);
|
|
}
|
|
|
|
-static void build_sk_flow_key(struct flowi4 *fl4, struct sock *sk)
|
|
+static void build_sk_flow_key(struct flowi4 *fl4, const struct sock *sk)
|
|
{
|
|
const struct inet_sock *inet = inet_sk(sk);
|
|
const struct ip_options_rcu *inet_opt;
|
|
@@ -561,11 +560,11 @@ static void build_sk_flow_key(struct flowi4 *fl4, struct sock *sk)
|
|
RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE,
|
|
inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,
|
|
inet_sk_flowi_flags(sk),
|
|
- daddr, inet->inet_saddr, 0, 0, sock_i_uid(sk));
|
|
+ daddr, inet->inet_saddr, 0, 0);
|
|
rcu_read_unlock();
|
|
}
|
|
|
|
-static void ip_rt_build_flow_key(struct flowi4 *fl4, struct sock *sk,
|
|
+static void ip_rt_build_flow_key(struct flowi4 *fl4, const struct sock *sk,
|
|
const struct sk_buff *skb)
|
|
{
|
|
if (skb)
|
|
@@ -1157,7 +1156,6 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
|
|
fl4.flowi4_oif = rt->dst.dev->ifindex;
|
|
fl4.flowi4_iif = skb->dev->ifindex;
|
|
fl4.flowi4_mark = skb->mark;
|
|
- fl4.flowi4_uid = skb->sk ? sock_i_uid(skb->sk) : 0;
|
|
|
|
rcu_read_lock();
|
|
if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res) == 0)
|
|
@@ -1448,7 +1446,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|
rth->rt_iif = 0;
|
|
rth->rt_pmtu = 0;
|
|
rth->rt_gateway = 0;
|
|
- rth->rt_uid = 0;
|
|
rth->rt_uses_gateway = 0;
|
|
INIT_LIST_HEAD(&rth->rt_uncached);
|
|
if (our) {
|
|
@@ -1572,7 +1569,6 @@ static int __mkroute_input(struct sk_buff *skb,
|
|
rth->rt_is_input = 1;
|
|
rth->rt_iif = 0;
|
|
rth->rt_pmtu = 0;
|
|
- rth->rt_uid = 0;
|
|
rth->rt_gateway = 0;
|
|
rth->rt_uses_gateway = 0;
|
|
INIT_LIST_HEAD(&rth->rt_uncached);
|
|
@@ -1743,7 +1739,6 @@ local_input:
|
|
rth->rt_is_input = 1;
|
|
rth->rt_iif = 0;
|
|
rth->rt_pmtu = 0;
|
|
- rth->rt_uid = 0;
|
|
rth->rt_gateway = 0;
|
|
rth->rt_uses_gateway = 0;
|
|
INIT_LIST_HEAD(&rth->rt_uncached);
|
|
@@ -1947,7 +1942,6 @@ add:
|
|
rth->rt_is_input = 0;
|
|
rth->rt_iif = orig_oif ? : 0;
|
|
rth->rt_pmtu = 0;
|
|
- rth->rt_uid = fl4->flowi4_uid;
|
|
rth->rt_gateway = 0;
|
|
rth->rt_uses_gateway = 0;
|
|
INIT_LIST_HEAD(&rth->rt_uncached);
|
|
@@ -2223,7 +2217,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
|
|
rt->rt_is_input = ort->rt_is_input;
|
|
rt->rt_iif = ort->rt_iif;
|
|
rt->rt_pmtu = ort->rt_pmtu;
|
|
- rt->rt_uid = ort->rt_uid;
|
|
|
|
rt->rt_genid = rt_genid(net);
|
|
rt->rt_flags = ort->rt_flags;
|
|
@@ -2334,10 +2327,6 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
|
|
nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark))
|
|
goto nla_put_failure;
|
|
|
|
- if (rt->rt_uid != (uid_t) -1 &&
|
|
- nla_put_u32(skb, RTA_UID, rt->rt_uid))
|
|
- goto nla_put_failure;
|
|
-
|
|
error = rt->dst.error;
|
|
|
|
if (rt_is_input_route(rt)) {
|
|
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
|
|
index c94032b95c6..5abb45e281b 100644
|
|
--- a/net/ipv4/syncookies.c
|
|
+++ b/net/ipv4/syncookies.c
|
|
@@ -353,8 +353,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
|
|
RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP,
|
|
inet_sk_flowi_flags(sk),
|
|
(opt && opt->srr) ? opt->faddr : ireq->rmt_addr,
|
|
- ireq->loc_addr, th->source, th->dest,
|
|
- sock_i_uid(sk));
|
|
+ ireq->loc_addr, th->source, th->dest);
|
|
security_req_classify_flow(req, flowi4_to_flowi(&fl4));
|
|
rt = ip_route_output_key(sock_net(sk), &fl4);
|
|
if (IS_ERR(rt)) {
|
|
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
|
|
index cba31349280..7a8af35c475 100644
|
|
--- a/net/ipv4/udp.c
|
|
+++ b/net/ipv4/udp.c
|
|
@@ -963,8 +963,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|
flowi4_init_output(fl4, ipc.oif, sk->sk_mark, tos,
|
|
RT_SCOPE_UNIVERSE, sk->sk_protocol,
|
|
inet_sk_flowi_flags(sk)|FLOWI_FLAG_CAN_SLEEP,
|
|
- faddr, saddr, dport, inet->inet_sport,
|
|
- sock_i_uid(sk));
|
|
+ faddr, saddr, dport, inet->inet_sport);
|
|
|
|
security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
|
|
rt = ip_route_output_flow(net, fl4, sk);
|
|
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
|
|
index 4c436751bf9..9b5b5ddf8cd 100644
|
|
--- a/net/ipv4/xfrm4_policy.c
|
|
+++ b/net/ipv4/xfrm4_policy.c
|
|
@@ -80,7 +80,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
|
|
const struct flowi4 *fl4 = &fl->u.ip4;
|
|
|
|
xdst->u.rt.rt_iif = fl4->flowi4_iif;
|
|
- xdst->u.rt.rt_uid = fl4->flowi4_uid;
|
|
|
|
xdst->u.dst.dev = dev;
|
|
dev_hold(dev);
|
|
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
|
|
index dc96abd0dbb..112e14fa81b 100644
|
|
--- a/net/ipv6/af_inet6.c
|
|
+++ b/net/ipv6/af_inet6.c
|
|
@@ -702,7 +702,6 @@ int inet6_sk_rebuild_header(struct sock *sk)
|
|
fl6.flowi6_mark = sk->sk_mark;
|
|
fl6.fl6_dport = inet->inet_dport;
|
|
fl6.fl6_sport = inet->inet_sport;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
|
|
|
rcu_read_lock();
|
|
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
|
|
index 193274c912f..0deea6ef4cc 100644
|
|
--- a/net/ipv6/datagram.c
|
|
+++ b/net/ipv6/datagram.c
|
|
@@ -162,7 +162,6 @@ ipv4_connected:
|
|
fl6.flowi6_mark = sk->sk_mark;
|
|
fl6.fl6_dport = inet->inet_dport;
|
|
fl6.fl6_sport = inet->inet_sport;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
|
|
if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST))
|
|
fl6.flowi6_oif = np->mcast_oif;
|
|
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
|
|
index f92676cb879..9cdb8e43451 100644
|
|
--- a/net/ipv6/inet6_connection_sock.c
|
|
+++ b/net/ipv6/inet6_connection_sock.c
|
|
@@ -86,7 +86,6 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
|
|
fl6->flowi6_mark = inet_rsk(req)->ir_mark;
|
|
fl6->fl6_dport = inet_rsk(req)->rmt_port;
|
|
fl6->fl6_sport = inet_rsk(req)->loc_port;
|
|
- fl6->flowi6_uid = sock_i_uid(sk);
|
|
security_req_classify_flow(req, flowi6_to_flowi(fl6));
|
|
|
|
dst = ip6_dst_lookup_flow(sk, fl6, final_p, false);
|
|
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
|
|
index 40c13d48dde..9215ccbec01 100644
|
|
--- a/net/ipv6/ping.c
|
|
+++ b/net/ipv6/ping.c
|
|
@@ -163,7 +163,6 @@ int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|
fl6.flowi6_mark = sk->sk_mark;
|
|
fl6.fl6_icmp_type = user_icmph.icmp6_type;
|
|
fl6.fl6_icmp_code = user_icmph.icmp6_code;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
|
|
|
|
if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
|
|
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
|
|
index 5a9539e871a..a98f5f05325 100644
|
|
--- a/net/ipv6/raw.c
|
|
+++ b/net/ipv6/raw.c
|
|
@@ -763,7 +763,6 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
|
|
memset(&fl6, 0, sizeof(fl6));
|
|
|
|
fl6.flowi6_mark = sk->sk_mark;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
|
|
if (sin6) {
|
|
if (addr_len < SIN6_LEN_RFC2133)
|
|
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
|
|
index 0f68d4db7d3..a6a9023e8fd 100644
|
|
--- a/net/ipv6/route.c
|
|
+++ b/net/ipv6/route.c
|
|
@@ -2247,7 +2247,6 @@ static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
|
|
[RTA_PRIORITY] = { .type = NLA_U32 },
|
|
[RTA_METRICS] = { .type = NLA_NESTED },
|
|
[RTA_MULTIPATH] = { .len = sizeof(struct rtnexthop) },
|
|
- [RTA_UID] = { .type = NLA_U32 },
|
|
};
|
|
|
|
static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
@@ -2636,11 +2635,6 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh)
|
|
if (tb[RTA_OIF])
|
|
oif = nla_get_u32(tb[RTA_OIF]);
|
|
|
|
- if (tb[RTA_UID])
|
|
- fl6.flowi6_uid = nla_get_u32(tb[RTA_UID]);
|
|
- else
|
|
- fl6.flowi6_uid = (iif ? (uid_t) -1 : current_uid());
|
|
-
|
|
if (iif) {
|
|
struct net_device *dev;
|
|
int flags = 0;
|
|
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
|
|
index 701d0656a40..a596f388339 100644
|
|
--- a/net/ipv6/syncookies.c
|
|
+++ b/net/ipv6/syncookies.c
|
|
@@ -243,7 +243,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
|
|
fl6.flowi6_mark = ireq->ir_mark;
|
|
fl6.fl6_dport = inet_rsk(req)->rmt_port;
|
|
fl6.fl6_sport = inet_sk(sk)->inet_sport;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
security_req_classify_flow(req, flowi6_to_flowi(&fl6));
|
|
|
|
dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
|
|
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
|
|
index c1310fc4d6c..57f152323b6 100644
|
|
--- a/net/ipv6/tcp_ipv6.c
|
|
+++ b/net/ipv6/tcp_ipv6.c
|
|
@@ -253,7 +253,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
|
fl6.flowi6_mark = sk->sk_mark;
|
|
fl6.fl6_dport = usin->sin6_port;
|
|
fl6.fl6_sport = inet->inet_sport;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
|
|
opt = rcu_dereference_protected(np->opt, sock_owned_by_user(sk));
|
|
final_p = fl6_update_dst(&fl6, opt, &final);
|
|
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
|
|
index 7de2ce1f299..5187bf51592 100644
|
|
--- a/net/ipv6/udp.c
|
|
+++ b/net/ipv6/udp.c
|
|
@@ -1149,7 +1149,6 @@ do_udp_sendmsg:
|
|
fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
|
|
|
|
fl6.flowi6_mark = sk->sk_mark;
|
|
- fl6.flowi6_uid = sock_i_uid(sk);
|
|
|
|
if (msg->msg_controllen) {
|
|
opt = &opt_space;
|
|
--
|
|
2.23.0
|
|
|