[sr-dev] git:5.1:a04c9310: core: fix Makefile.defs errors to include raw socket support

Henning Westerholt hw at kamailio.org
Thu Jun 14 08:37:11 CEST 2018


Module: kamailio
Branch: 5.1
Commit: a04c931064d1332a7c23264a33268d3ecec793a2
URL: https://github.com/kamailio/kamailio/commit/a04c931064d1332a7c23264a33268d3ecec793a2

Author: Edwin Fine <edwin at 2600hz.com>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-06-14T08:36:14+02:00

core: fix Makefile.defs errors to include raw socket support

Compiling kamailio on `linux`, `gnu_kfreebsd`, and `freebsd` -
unless `RAW_SOCKS` is set up otherwise -
should automatically enable raw sockets, according to `Makefile.defs`
[L97][]:

    # enable raw sockets
    RAW_SOCKS ?= yes
    ifeq ($(RAW_SOCKS),1)
        RAW_SOCKS = yes
    endif

By all indications, if `RAW_SOCKS` is unset, set to `1`, or set to `yes`
before this `ifeq` statement, it will be set to `yes` after the `endif`.

The issue arises later on in `Makefile.defs` [L1758][] (and also
[L1808][] and [L1892]):

    #os specific stuff
    ifeq ($(OS), linux)
    # by default use futexes if available
        use_futex= yes
        C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
                -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
                -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN
        ifneq ($(RAW_SOCKS), yes)  ### <--- The issue ###
            C_DEFS+= -DUSE_RAW_SOCKS
        endif

Clearly, the `ifneq` should be `ifeq`.

This commit fixes the issue by making the above changes, and `kamailio`
should compile on Linux - by default - with raw sockets support unless
`RAW_SOCKS` is explicitly set prior to evaluation to something other
than `yes` or `1`.

[L97]: https://github.com/kamailio/kamailio/blob/a57a96f8fea3a5f7bff068ab0ea0d4c17c15bb65/src/Makefile.defs#L97
[L1758]: https://github.com/kamailio/kamailio/blob/a57a96f8fea3a5f7bff068ab0ea0d4c17c15bb65/src/Makefile.defs#L1758
[L1808]: https://github.com/kamailio/kamailio/blob/a57a96f8fea3a5f7bff068ab0ea0d4c17c15bb65/src/Makefile.defs#L1808
[L1892]: https://github.com/kamailio/kamailio/blob/a57a96f8fea3a5f7bff068ab0ea0d4c17c15bb65/src/Makefile.defs#L1892

(cherry picked from commit 1d4ee7720c6f609077e4497189103f9a950f4194)

---

Modified: src/Makefile.defs

---

Diff:  https://github.com/kamailio/kamailio/commit/a04c931064d1332a7c23264a33268d3ecec793a2.diff
Patch: https://github.com/kamailio/kamailio/commit/a04c931064d1332a7c23264a33268d3ecec793a2.patch

---

diff --git a/src/Makefile.defs b/src/Makefile.defs
index 3b1066da95..9b809b8bfa 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -1755,7 +1755,7 @@ ifeq ($(OS), linux)
 	C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
 			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN
-	ifneq ($(RAW_SOCKS), yes)
+	ifeq ($(RAW_SOCKS), yes)
 		C_DEFS+= -DUSE_RAW_SOCKS
 	endif
 	ifneq ($(found_lock_method), yes)
@@ -1805,7 +1805,7 @@ ifeq ($(OS), gnu_kfreebsd)
 	C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
 			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
 			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
-	ifneq ($(RAW_SOCKS), yes)
+	ifeq ($(RAW_SOCKS), yes)
 		C_DEFS+= -DUSE_RAW_SOCKS
 	endif
 	ifneq ($(found_lock_method), yes)
@@ -1889,7 +1889,7 @@ ifeq ($(OS), freebsd)
 		-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
 		-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
 		-DHAVE_NETINET_IN_SYSTM -DHAVE_IP_MREQN
-	ifneq ($(RAW_SOCKS), yes)
+	ifeq ($(RAW_SOCKS), yes)
 		C_DEFS+= -DUSE_RAW_SOCKS
 	endif
 	ifneq ($(found_lock_method), yes)




More information about the sr-dev mailing list