netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH [iputils] 1/5] start gitignore files
@ 2014-04-19 14:43 Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 2/5] doc: fix parallel build of html/man pages Mike Frysinger
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Mike Frysinger @ 2014-04-19 14:43 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev, David Heidelberger

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 .gitignore     | 22 ++++++++++++++++++++++
 doc/.gitignore |  2 ++
 2 files changed, 24 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 doc/.gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..30ed00c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+*~
+*.o
+
+*.diff
+*.orig
+*.patch
+*.rej
+
+core
+.gdb_history
+.gdbinit
+
+/arping
+/clockdiff
+/ping
+/ping6
+/rarpd
+/rdisc
+/tftpd
+/tracepath
+/tracepath6
+/traceroute6
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..085639f
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,2 @@
+*.html
+*.8
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH [iputils] 2/5] doc: fix parallel build of html/man pages
  2014-04-19 14:43 [PATCH [iputils] 1/5] start gitignore files Mike Frysinger
@ 2014-04-19 14:43 ` Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 3/5] ping6: allow disabling of openssl support Mike Frysinger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2014-04-19 14:43 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev, David Heidelberger

The use of the same tempdir prevents building of these files in parallel.
So build all of them in unique tempdirs so we can do them in parallel.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 doc/Makefile | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/doc/Makefile b/doc/Makefile
index 7ec4f1c..a9c303e 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -12,29 +12,40 @@ man: $(MANFILES)
 # lots of some strange temporary junk directories and files.
 # So, scope it to a temporary dir and clean all after each run.
 
-$(HTMLFILES): index.db
-	@-rm -rf tmp.db2html
-	@mkdir tmp.db2html
-	@set -e; cd tmp.db2html; docbook2html ../$< ; mv *.html ..
-	@-rm -rf tmp.db2html
+SETUP_TMPDIR = \
+	t="tmp.db2html.$@"; \
+	rm -rf $$t; \
+	mkdir $$t; \
+	pushd $$t >/dev/null
+CLEAN_TMPDIR = \
+	popd >/dev/null; \
+	rm -rf $$t
+
+MAKE_HTML = \
+	@set -e; \
+	$(SETUP_TMPDIR); \
+	docbook2html ../$<; \
+	mv *.html ..; \
+	$(CLEAN_TMPDIR)
 
+$(HTMLFILES): index.db
+	$(MAKE_HTML)
 iputils.html: iputils.db
-	@-rm -rf tmp.db2html
-	@mkdir tmp.db2html
-	@set -e; cd tmp.db2html; docbook2html -u -o html ../$< ; mv html/$@ ..
-	@-rm -rf tmp.db2html
+	$(MAKE_HTML)
 
 # docbook2man produces utterly ugly output and I did not find
 # any way to customize this but hacking backend perl script a little.
 # Well, hence...
 
 $(MANFILES): index.db
-	@-mkdir tmp.db2man
-	@set -e; cd tmp.db2man; nsgmls ../$< | sgmlspl ../docbook2man-spec.pl ;	mv $@ ..
-	@-rm -rf tmp.db2man
+	@set -e; \
+	$(SETUP_TMPDIR); \
+	nsgmls ../$< | sgmlspl ../docbook2man-spec.pl; \
+	mv $@ ..; \
+	$(CLEAN_TMPDIR)
 
 clean:
-	@rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html tmp.db2man
+	@rm -rf $(MANFILES) $(HTMLFILES) iputils.html tmp.db2html* tmp.db2man*
 
 snapshot:
 	@date "+%y%m%d" > snapshot.db
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH [iputils] 3/5] ping6: allow disabling of openssl support
  2014-04-19 14:43 [PATCH [iputils] 1/5] start gitignore files Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 2/5] doc: fix parallel build of html/man pages Mike Frysinger
@ 2014-04-19 14:43 ` Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 4/5] fix handling of CFLAGS Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 5/5] tftpd: check return value of set*id calls Mike Frysinger
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2014-04-19 14:43 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev, David Heidelberger

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Makefile |  5 ++++-
 ping6.c  | 14 +++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 89249f5..2c49940 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ ARPING_DEFAULT_DEVICE=
 
 # GNU TLS library for ping6 [yes|no|static]
 USE_GNUTLS=yes
-# Crypto library for ping6 [shared|static]
+# Crypto library for ping6 [shared|static|no]
 USE_CRYPTO=shared
 # Resolv library for ping6 [yes|static]
 USE_RESOLV=yes
@@ -63,7 +63,10 @@ ifneq ($(USE_GNUTLS),no)
 	LIB_CRYPTO = $(call FUNC_LIB,$(USE_GNUTLS),$(LDFLAG_GNUTLS))
 	DEF_CRYPTO = -DUSE_GNUTLS
 else
+ifneq ($(USE_CRYPTO),no)
 	LIB_CRYPTO = $(call FUNC_LIB,$(USE_CRYPTO),$(LDFLAG_CRYPTO))
+	DEF_CRYPTO = -DUSE_OPENSSL
+endif
 endif
 
 # USE_RESOLV: LIB_RESOLV
diff --git a/ping6.c b/ping6.c
index c39864d..f2f90af 100644
--- a/ping6.c
+++ b/ping6.c
@@ -168,8 +168,10 @@ static int icmp_sock;
 
 #ifdef USE_GNUTLS
 # include <gnutls/openssl.h>
-#else
+# define USE_CRYPTO
+#elif defined USE_OPENSSL
 # include <openssl/md5.h>
+# define USE_CRYPTO
 #endif
 
 /* Node Information query */
@@ -326,6 +328,7 @@ static void niquery_init_nonce(void)
 #if !PING6_NONCE_MEMORY
 static int niquery_nonce(__u8 *nonce, int fill)
 {
+# ifdef USE_CRYPTO
 	static __u8 digest[MD5_DIGEST_LENGTH];
 	static int seq = -1;
 
@@ -348,6 +351,10 @@ static int niquery_nonce(__u8 *nonce, int fill)
 			return -1;
 		return ntohsp((__u16 *)nonce);
 	}
+# else
+	fprintf(stderr, "ping6: function not available; crypto disabled\n");
+	exit(3);
+# endif
 }
 #endif
 
@@ -502,6 +509,7 @@ static int niquery_option_subject_addr_handler(int index, const char *arg)
 
 static int niquery_option_subject_name_handler(int index, const char *arg)
 {
+#ifdef USE_CRYPTO
 	static char nigroup_buf[INET6_ADDRSTRLEN + 1 + IFNAMSIZ];
 	unsigned char *dnptrs[2], **dpp, **lastdnptr;
 	int n;
@@ -627,6 +635,10 @@ errexit:
 	free(idn);
 	free(name);
 	exit(1);
+#else
+	fprintf(stderr, "ping6: function not available; crypto disabled\n");
+	exit(3);
+#endif
 }
 
 int niquery_option_help_handler(int index, const char *arg)
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH [iputils] 4/5] fix handling of CFLAGS
  2014-04-19 14:43 [PATCH [iputils] 1/5] start gitignore files Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 2/5] doc: fix parallel build of html/man pages Mike Frysinger
  2014-04-19 14:43 ` [PATCH [iputils] 3/5] ping6: allow disabling of openssl support Mike Frysinger
@ 2014-04-19 14:43 ` Mike Frysinger
  2014-04-19 18:55   ` David Heidelberger
  2014-04-19 14:43 ` [PATCH [iputils] 5/5] tftpd: check return value of set*id calls Mike Frysinger
  3 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2014-04-19 14:43 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev, David Heidelberger

This defaults CFLAGS to -O3 without clobbering settings people have set
up in the environment already.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Makefile | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 2c49940..ecabac3 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,6 @@
 # Configuration
 #
 
-# CC
-CC=gcc
 # Path to parent kernel include files directory
 LIBC_INCLUDE=/usr/include
 # Libraries
@@ -48,11 +46,10 @@ ENABLE_RDISC_SERVER=no
 
 # -------------------------------------
 # What a pity, all new gccs are buggy and -Werror does not work. Sigh.
-# CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g
-CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -g
-CCOPTOPT=-O3
-GLIBCFIX=-D_GNU_SOURCE
-DEFINES=
+# CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g
+CFLAGS?=-O3 -g
+CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall
+CPPFLAGS+=-D_GNU_SOURCE
 LDLIB=
 
 FUNC_LIB = $(if $(filter static,$(1)),$(LDFLAG_STATIC) $(2) $(LDFLAG_DYNAMIC),$(2))
@@ -113,7 +110,6 @@ IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
 IPV6_TARGETS=tracepath6 traceroute6 ping6
 TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
 
-CFLAGS=$(CCOPTOPT) $(CCOPT) $(GLIBCFIX) $(DEFINES)
 LDLIBS=$(LDLIB) $(ADDLIB)
 
 UNAME_N:=$(shell uname -n)
@@ -132,6 +128,7 @@ all: $(TARGETS)
 	$(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -S -o $@
 %.o: %.c
 	$(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -o $@
+LINK.o += $(CFLAGS)
 $(TARGETS): %: %.o
 	$(LINK.o) $^ $(LIB_$@) $(LDLIBS) -o $@
 
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH [iputils] 5/5] tftpd: check return value of set*id calls
  2014-04-19 14:43 [PATCH [iputils] 1/5] start gitignore files Mike Frysinger
                   ` (2 preceding siblings ...)
  2014-04-19 14:43 ` [PATCH [iputils] 4/5] fix handling of CFLAGS Mike Frysinger
@ 2014-04-19 14:43 ` Mike Frysinger
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2014-04-19 14:43 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev, David Heidelberger

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 tftpd.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tftpd.c b/tftpd.c
index 2a39ec4..6519de3 100644
--- a/tftpd.c
+++ b/tftpd.c
@@ -109,17 +109,20 @@ int main(int ac, char **av)
 	register int n = 0;
 	int on = 1;
 
+	openlog("tftpd", LOG_PID, LOG_DAEMON);
+
 	/* Sanity. If parent forgot to setuid() on us. */
 	if (geteuid() == 0) {
-		setgid(65534);
-		setuid(65534);
+		if (setgid(65534) || setuid(65534)) {
+			syslog(LOG_ERR, "set*id failed: %m\n");
+			exit(1);
+		}
 	}
 
 	ac--; av++;
 	while (ac-- > 0 && n < MAXARG)
 		dirs[n++] = *av++;
 
-	openlog("tftpd", LOG_PID, LOG_DAEMON);
 	if (ioctl(0, FIONBIO, &on) < 0) {
 		syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
 		exit(1);
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH [iputils] 4/5] fix handling of CFLAGS
  2014-04-19 14:43 ` [PATCH [iputils] 4/5] fix handling of CFLAGS Mike Frysinger
@ 2014-04-19 18:55   ` David Heidelberger
  2014-04-20  3:01     ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: David Heidelberger @ 2014-04-19 18:55 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: YOSHIFUJI Hideaki, netdev

Hey Mike,

I'd like to set CC if is unset, check this patch, if it look sane for 
you :)
https://github.com/iputils/iputils/commit/77ab88974eb4424620e4caa1dcd4bebe020a3b4e

David

Dne 2014-04-19 16:43, Mike Frysinger napsal:
> This defaults CFLAGS to -O3 without clobbering settings people have set
> up in the environment already.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  Makefile | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 2c49940..ecabac3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2,8 +2,6 @@
>  # Configuration
>  #
> 
> -# CC
> -CC=gcc
>  # Path to parent kernel include files directory
>  LIBC_INCLUDE=/usr/include
>  # Libraries
> @@ -48,11 +46,10 @@ ENABLE_RDISC_SERVER=no
> 
>  # -------------------------------------
>  # What a pity, all new gccs are buggy and -Werror does not work. Sigh.
> -# CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g
> -CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -g
> -CCOPTOPT=-O3
> -GLIBCFIX=-D_GNU_SOURCE
> -DEFINES=
> +# CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g
> +CFLAGS?=-O3 -g
> +CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall
> +CPPFLAGS+=-D_GNU_SOURCE
>  LDLIB=
> 
>  FUNC_LIB = $(if $(filter static,$(1)),$(LDFLAG_STATIC) $(2)
> $(LDFLAG_DYNAMIC),$(2))
> @@ -113,7 +110,6 @@ IPV4_TARGETS=tracepath ping clockdiff rdisc arping
> tftpd rarpd
>  IPV6_TARGETS=tracepath6 traceroute6 ping6
>  TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
> 
> -CFLAGS=$(CCOPTOPT) $(CCOPT) $(GLIBCFIX) $(DEFINES)
>  LDLIBS=$(LDLIB) $(ADDLIB)
> 
>  UNAME_N:=$(shell uname -n)
> @@ -132,6 +128,7 @@ all: $(TARGETS)
>  	$(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -S -o $@
>  %.o: %.c
>  	$(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -o $@
> +LINK.o += $(CFLAGS)
>  $(TARGETS): %: %.o
>  	$(LINK.o) $^ $(LIB_$@) $(LDLIBS) -o $@

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH [iputils] 4/5] fix handling of CFLAGS
  2014-04-19 18:55   ` David Heidelberger
@ 2014-04-20  3:01     ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2014-04-20  3:01 UTC (permalink / raw)
  To: David Heidelberger; +Cc: YOSHIFUJI Hideaki, netdev

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

On Sat 19 Apr 2014 20:55:17 David Heidelberger wrote:
> I'd like to set CC if is unset, check this patch, if it look sane for
> you :)
> https://github.com/iputils/iputils/commit/77ab88974eb4424620e4caa1dcd4bebe02
> 0a3b4e

unfortunately that won't do anything.  make provides a default CC so that code 
will effectively never get used.

you could just delete the line.  realistically, the default (cc) is going to 
be gcc on any system where this code is built.

alternatively, you can use the pattern:
ifeq ($(origin CC),default)
CC = gcc
endif
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-20  3:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-19 14:43 [PATCH [iputils] 1/5] start gitignore files Mike Frysinger
2014-04-19 14:43 ` [PATCH [iputils] 2/5] doc: fix parallel build of html/man pages Mike Frysinger
2014-04-19 14:43 ` [PATCH [iputils] 3/5] ping6: allow disabling of openssl support Mike Frysinger
2014-04-19 14:43 ` [PATCH [iputils] 4/5] fix handling of CFLAGS Mike Frysinger
2014-04-19 18:55   ` David Heidelberger
2014-04-20  3:01     ` Mike Frysinger
2014-04-19 14:43 ` [PATCH [iputils] 5/5] tftpd: check return value of set*id calls Mike Frysinger

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).