diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2016-03-14 12:02:07 +0100 |
---|---|---|
committer | Philip Tricca <flihp@twobit.us> | 2016-03-16 17:35:38 +0000 |
commit | e93d2e8bac96949fd37d4ae89fbaf5a67d371f77 (patch) | |
tree | cf0d288bb5e0401a2e2d61547e0bb8a8e7ce6505 | |
parent | f0e3eb60daa5d73f9882d76ec668e77843e37c43 (diff) | |
download | meta-selinux-e93d2e8bac96949fd37d4ae89fbaf5a67d371f77.tar.gz |
net-tools: Rebase netstat-selinux-support.patch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Signed-off-by: Philip Tricca <flihp@twobit.us>
-rw-r--r-- | recipes-extended/net-tools/net-tools/netstat-selinux-support.patch | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/recipes-extended/net-tools/net-tools/netstat-selinux-support.patch b/recipes-extended/net-tools/net-tools/netstat-selinux-support.patch index 2a97216..f089041 100644 --- a/recipes-extended/net-tools/net-tools/netstat-selinux-support.patch +++ b/recipes-extended/net-tools/net-tools/netstat-selinux-support.patch | |||
@@ -5,13 +5,14 @@ Subject: [PATCH] net-tools: netstat add SELinux support. | |||
5 | Upstream-Status: Inappropriate [configuration] | 5 | Upstream-Status: Inappropriate [configuration] |
6 | 6 | ||
7 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | 7 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> |
8 | Signed-off-by: Adrian Dudau <adrian.dudau@enea.com> | ||
8 | --- | 9 | --- |
9 | Makefile | 9 +++++++- | 10 | Makefile | 9 ++++++++- |
10 | netstat.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | 11 | netstat.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- |
11 | 2 files changed, 74 insertions(+), 4 deletions(-) | 12 | 2 files changed, 74 insertions(+), 4 deletions(-) |
12 | 13 | ||
13 | diff --git a/Makefile b/Makefile | 14 | diff --git a/Makefile b/Makefile |
14 | index 8fcc55c..dca8fbc 100644 | 15 | index 8fcc55c..0b5c395 100644 |
15 | --- a/Makefile | 16 | --- a/Makefile |
16 | +++ b/Makefile | 17 | +++ b/Makefile |
17 | @@ -116,6 +116,13 @@ NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a | 18 | @@ -116,6 +116,13 @@ NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a |
@@ -38,12 +39,12 @@ index 8fcc55c..dca8fbc 100644 | |||
38 | iptunnel: $(NET_LIB) iptunnel.o | 39 | iptunnel: $(NET_LIB) iptunnel.o |
39 | $(CC) $(LDFLAGS) -o iptunnel iptunnel.o $(NLIB) $(RESLIB) | 40 | $(CC) $(LDFLAGS) -o iptunnel iptunnel.o $(NLIB) $(RESLIB) |
40 | diff --git a/netstat.c b/netstat.c | 41 | diff --git a/netstat.c b/netstat.c |
41 | index c3a7bb1..71be41f 100644 | 42 | index fc10414..a773e81 100644 |
42 | --- a/netstat.c | 43 | --- a/netstat.c |
43 | +++ b/netstat.c | 44 | +++ b/netstat.c |
44 | @@ -86,6 +86,12 @@ | 45 | @@ -90,6 +90,12 @@ |
45 | #include <net/if.h> | 46 | #include <sys/types.h> |
46 | #include <dirent.h> | 47 | #include <asm-generic/param.h> |
47 | 48 | ||
48 | +#if HAVE_SELINUX | 49 | +#if HAVE_SELINUX |
49 | +#include <selinux/selinux.h> | 50 | +#include <selinux/selinux.h> |
@@ -54,7 +55,7 @@ index c3a7bb1..71be41f 100644 | |||
54 | #include "net-support.h" | 55 | #include "net-support.h" |
55 | #include "pathnames.h" | 56 | #include "pathnames.h" |
56 | #include "version.h" | 57 | #include "version.h" |
57 | @@ -97,6 +103,7 @@ | 58 | @@ -101,6 +107,7 @@ |
58 | #include "proc.h" | 59 | #include "proc.h" |
59 | 60 | ||
60 | #define PROGNAME_WIDTH 20 | 61 | #define PROGNAME_WIDTH 20 |
@@ -62,7 +63,7 @@ index c3a7bb1..71be41f 100644 | |||
62 | 63 | ||
63 | #if !defined(s6_addr32) && defined(in6a_words) | 64 | #if !defined(s6_addr32) && defined(in6a_words) |
64 | #define s6_addr32 in6a_words /* libinet6 */ | 65 | #define s6_addr32 in6a_words /* libinet6 */ |
65 | @@ -153,6 +160,7 @@ int flag_wide= 0; | 66 | @@ -180,6 +187,7 @@ int flag_wide= 0; |
66 | int flag_prg = 0; | 67 | int flag_prg = 0; |
67 | int flag_arg = 0; | 68 | int flag_arg = 0; |
68 | int flag_ver = 0; | 69 | int flag_ver = 0; |
@@ -70,7 +71,7 @@ index c3a7bb1..71be41f 100644 | |||
70 | 71 | ||
71 | FILE *procinfo; | 72 | FILE *procinfo; |
72 | 73 | ||
73 | @@ -216,12 +224,17 @@ FILE *procinfo; | 74 | @@ -243,12 +251,17 @@ FILE *procinfo; |
74 | #define PROGNAME_WIDTH1(s) PROGNAME_WIDTH2(s) | 75 | #define PROGNAME_WIDTH1(s) PROGNAME_WIDTH2(s) |
75 | #define PROGNAME_WIDTH2(s) #s | 76 | #define PROGNAME_WIDTH2(s) #s |
76 | 77 | ||
@@ -88,7 +89,7 @@ index c3a7bb1..71be41f 100644 | |||
88 | } *prg_hash[PRG_HASH_SIZE]; | 89 | } *prg_hash[PRG_HASH_SIZE]; |
89 | 90 | ||
90 | static char prg_cache_loaded = 0; | 91 | static char prg_cache_loaded = 0; |
91 | @@ -229,9 +242,12 @@ static char prg_cache_loaded = 0; | 92 | @@ -256,9 +269,12 @@ static char prg_cache_loaded = 0; |
92 | #define PRG_HASHIT(x) ((x) % PRG_HASH_SIZE) | 93 | #define PRG_HASHIT(x) ((x) % PRG_HASH_SIZE) |
93 | 94 | ||
94 | #define PROGNAME_BANNER "PID/Program name" | 95 | #define PROGNAME_BANNER "PID/Program name" |
@@ -101,7 +102,7 @@ index c3a7bb1..71be41f 100644 | |||
101 | #define PRG_LOCAL_ADDRESS "local_address" | 102 | #define PRG_LOCAL_ADDRESS "local_address" |
102 | #define PRG_INODE "inode" | 103 | #define PRG_INODE "inode" |
103 | #define PRG_SOCKET_PFX "socket:[" | 104 | #define PRG_SOCKET_PFX "socket:[" |
104 | @@ -253,7 +269,7 @@ static char prg_cache_loaded = 0; | 105 | @@ -280,7 +296,7 @@ static char prg_cache_loaded = 0; |
105 | /* NOT working as of glibc-2.0.7: */ | 106 | /* NOT working as of glibc-2.0.7: */ |
106 | #undef DIRENT_HAVE_D_TYPE_WORKS | 107 | #undef DIRENT_HAVE_D_TYPE_WORKS |
107 | 108 | ||
@@ -110,7 +111,7 @@ index c3a7bb1..71be41f 100644 | |||
110 | { | 111 | { |
111 | unsigned hi = PRG_HASHIT(inode); | 112 | unsigned hi = PRG_HASHIT(inode); |
112 | struct prg_node **pnp,*pn; | 113 | struct prg_node **pnp,*pn; |
113 | @@ -274,6 +290,14 @@ static void prg_cache_add(unsigned long inode, char *name) | 114 | @@ -301,6 +317,14 @@ static void prg_cache_add(unsigned long inode, char *name) |
114 | if (strlen(name)>sizeof(pn->name)-1) | 115 | if (strlen(name)>sizeof(pn->name)-1) |
115 | name[sizeof(pn->name)-1]='\0'; | 116 | name[sizeof(pn->name)-1]='\0'; |
116 | strcpy(pn->name,name); | 117 | strcpy(pn->name,name); |
@@ -125,7 +126,7 @@ index c3a7bb1..71be41f 100644 | |||
125 | } | 126 | } |
126 | 127 | ||
127 | static const char *prg_cache_get(unsigned long inode) | 128 | static const char *prg_cache_get(unsigned long inode) |
128 | @@ -286,6 +310,16 @@ static const char *prg_cache_get(unsigned long inode) | 129 | @@ -313,6 +337,16 @@ static const char *prg_cache_get(unsigned long inode) |
129 | return("-"); | 130 | return("-"); |
130 | } | 131 | } |
131 | 132 | ||
@@ -142,7 +143,7 @@ index c3a7bb1..71be41f 100644 | |||
142 | static void prg_cache_clear(void) | 143 | static void prg_cache_clear(void) |
143 | { | 144 | { |
144 | struct prg_node **pnp,*pn; | 145 | struct prg_node **pnp,*pn; |
145 | @@ -357,6 +391,7 @@ static void prg_cache_load(void) | 146 | @@ -384,6 +418,7 @@ static void prg_cache_load(void) |
146 | const char *cs,*cmdlp; | 147 | const char *cs,*cmdlp; |
147 | DIR *dirproc=NULL,*dirfd=NULL; | 148 | DIR *dirproc=NULL,*dirfd=NULL; |
148 | struct dirent *direproc,*direfd; | 149 | struct dirent *direproc,*direfd; |
@@ -150,7 +151,7 @@ index c3a7bb1..71be41f 100644 | |||
150 | 151 | ||
151 | if (prg_cache_loaded || !flag_prg) return; | 152 | if (prg_cache_loaded || !flag_prg) return; |
152 | prg_cache_loaded=1; | 153 | prg_cache_loaded=1; |
153 | @@ -426,7 +461,15 @@ static void prg_cache_load(void) | 154 | @@ -453,7 +488,15 @@ static void prg_cache_load(void) |
154 | } | 155 | } |
155 | 156 | ||
156 | snprintf(finbuf, sizeof(finbuf), "%s/%s", direproc->d_name, cmdlp); | 157 | snprintf(finbuf, sizeof(finbuf), "%s/%s", direproc->d_name, cmdlp); |
@@ -167,7 +168,7 @@ index c3a7bb1..71be41f 100644 | |||
167 | } | 168 | } |
168 | closedir(dirfd); | 169 | closedir(dirfd); |
169 | dirfd = NULL; | 170 | dirfd = NULL; |
170 | @@ -546,6 +589,8 @@ static void finish_this_one(int uid, unsigned long inode, const char *timers) | 171 | @@ -573,6 +616,8 @@ static void finish_this_one(int uid, unsigned long inode, const char *timers) |
171 | } | 172 | } |
172 | if (flag_prg) | 173 | if (flag_prg) |
173 | printf(" %-16s",prg_cache_get(inode)); | 174 | printf(" %-16s",prg_cache_get(inode)); |
@@ -176,7 +177,7 @@ index c3a7bb1..71be41f 100644 | |||
176 | if (flag_opt) | 177 | if (flag_opt) |
177 | printf(" %s", timers); | 178 | printf(" %s", timers); |
178 | putchar('\n'); | 179 | putchar('\n'); |
179 | @@ -1238,6 +1283,8 @@ static void unix_do_one(int nr, const char *line) | 180 | @@ -1566,6 +1611,8 @@ static void unix_do_one(int nr, const char *line) |
180 | printf("- "); | 181 | printf("- "); |
181 | if (flag_prg) | 182 | if (flag_prg) |
182 | printf("%-" PROGNAME_WIDTHs "s",(has & HAS_INODE?prg_cache_get(inode):"-")); | 183 | printf("%-" PROGNAME_WIDTHs "s",(has & HAS_INODE?prg_cache_get(inode):"-")); |
@@ -185,7 +186,7 @@ index c3a7bb1..71be41f 100644 | |||
185 | puts(path); | 186 | puts(path); |
186 | } | 187 | } |
187 | 188 | ||
188 | @@ -1256,6 +1303,7 @@ static int unix_info(void) | 189 | @@ -1584,6 +1631,7 @@ static int unix_info(void) |
189 | 190 | ||
190 | printf(_("\nProto RefCnt Flags Type State I-Node ")); | 191 | printf(_("\nProto RefCnt Flags Type State I-Node ")); |
191 | print_progname_banner(); | 192 | print_progname_banner(); |
@@ -193,15 +194,15 @@ index c3a7bb1..71be41f 100644 | |||
193 | printf(_(" Path\n")); /* xxx */ | 194 | printf(_(" Path\n")); /* xxx */ |
194 | 195 | ||
195 | { | 196 | { |
196 | @@ -1546,6 +1594,7 @@ static void usage(void) | 197 | @@ -1874,6 +1922,7 @@ static void usage(void) |
197 | fprintf(stderr, _(" -o, --timers display timers\n")); | 198 | fprintf(stderr, _(" -o, --timers display timers\n")); |
198 | fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); | 199 | fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); |
199 | fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); | 200 | fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); |
200 | + fprintf(stderr, _(" -Z, --context display SELinux security context for sockets\n\n")); | 201 | + fprintf(stderr, _(" -Z, --context display SELinux security context for sockets\n\n")); |
201 | 202 | ||
202 | fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); | 203 | fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); |
203 | fprintf(stderr, _(" <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF); | 204 | fprintf(stderr, _(" <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF); |
204 | @@ -1591,6 +1640,7 @@ int main | 205 | @@ -1920,6 +1969,7 @@ int main |
205 | {"cache", 0, 0, 'C'}, | 206 | {"cache", 0, 0, 'C'}, |
206 | {"fib", 0, 0, 'F'}, | 207 | {"fib", 0, 0, 'F'}, |
207 | {"groups", 0, 0, 'g'}, | 208 | {"groups", 0, 0, 'g'}, |
@@ -209,16 +210,16 @@ index c3a7bb1..71be41f 100644 | |||
209 | {NULL, 0, 0, 0} | 210 | {NULL, 0, 0, 0} |
210 | }; | 211 | }; |
211 | 212 | ||
212 | @@ -1602,7 +1652,7 @@ int main | 213 | @@ -1931,7 +1981,7 @@ int main |
213 | getroute_init(); /* Set up AF routing support */ | 214 | getroute_init(); /* Set up AF routing support */ |
214 | 215 | ||
215 | afname[0] = '\0'; | 216 | afname[0] = '\0'; |
216 | - while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuWVv?wxl64", longopts, &lop)) != EOF) | 217 | - while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuSWVv?wxl64", longopts, &lop)) != EOF) |
217 | + while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuWVv?wxlZ64", longopts, &lop)) != EOF) | 218 | + while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuSWVv?wxlZ64", longopts, &lop)) != EOF) |
218 | switch (i) { | 219 | switch (i) { |
219 | case -1: | 220 | case -1: |
220 | break; | 221 | break; |
221 | @@ -1705,6 +1755,19 @@ int main | 222 | @@ -2036,6 +2086,19 @@ int main |
222 | if (aftrans_opt("unix")) | 223 | if (aftrans_opt("unix")) |
223 | exit(1); | 224 | exit(1); |
224 | break; | 225 | break; |
@@ -239,5 +240,5 @@ index c3a7bb1..71be41f 100644 | |||
239 | case 'h': | 240 | case 'h': |
240 | usage(); | 241 | usage(); |
241 | -- | 242 | -- |
242 | 1.7.5.4 | 243 | 1.9.1 |
243 | 244 | ||