You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "JosiahWI (via GitHub)" <gi...@apache.org> on 2023/06/20 13:29:29 UTC

[GitHub] [trafficserver] JosiahWI opened a new pull request, #9884: Add transparent proxy support to CMake build

JosiahWI opened a new pull request, #9884:
URL: https://github.com/apache/trafficserver/pull/9884

   This adds a new option that defaults to AUTO: ENABLE_TPROXY. The option has a number of permissible settings which are explained in the option's documentation string.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #9884: Add transparent proxy support to CMake build

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #9884:
URL: https://github.com/apache/trafficserver/pull/9884#issuecomment-1598871299

   [approve ci autest]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] cmcfarlen commented on a diff in pull request #9884: Add transparent proxy support to CMake build

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on code in PR #9884:
URL: https://github.com/apache/trafficserver/pull/9884#discussion_r1235450490


##########
cmake/ConfigureTransparentProxy.cmake:
##########
@@ -0,0 +1,74 @@
+#######################
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+#  agreements.  See the NOTICE file distributed with this work for additional information regarding
+#  copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with the License.  You may obtain
+#  a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software distributed under the License
+#  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+#  or implied. See the License for the specific language governing permissions and limitations under
+#  the License.
+#
+#######################
+
+# ConfigureTransparentProxy.cmake
+#
+# The following variables should be set
+#
+#     ENABLE_TPROXY to one of AUTO, NO, or a number
+#     TS_USE_POSIX_CAP to a boolean value
+#
+# This will define the following variables
+#
+#     TS_USE_TPROXY
+#     TS_IP_TRANSPARENT
+#
+
+set(TS_IP_TRANSPARENT 0)
+
+if(ENABLE_TPROXY STREQUAL "NO")
+    set(TS_USE_TPROXY FALSE)
+    return()
+endif()
+
+if(NOT TS_USE_POSIX_CAP)
+    if(ENABLE_TPROXY STREQUAL "AUTO")
+        set(TS_USE_TPROXY FALSE)
+    else()
+        message(FATAL_ERROR "ENABLE_TPROXY requires POSIX capabilities.")
+    endif()
+    return()
+endif()
+
+if(ENABLE_TPROXY STREQUAL "FORCE")
+    set(TS_USE_TPROXY TRUE)
+    set(TS_IP_TRANSPARENT 19)
+    return()
+endif()
+
+if(ENABLE_TPROXY MATCHES "([0-9]+)")
+    set(TS_USE_TPROXY TRUE)
+    set(TS_IP_TRANSPARENT ${CMAKE_MATCH_1})
+    return()
+endif()
+
+# If the read fails, it will print out a confusing error. This
+# is to make it clear why the error is happening in that case.
+message("ENABLE_TPROXY enabled, looking for value in /usr/include/linux/in.h")
+file(READ "/usr/include/linux/in.h" HEADER_CONTENTS)
+if(HEADER_CONTENTS MATCHES "#define[ \t]+IP_TRANSPARENT[ \t]+([0-9]+)")
+    set(TS_USE_TPROXY TRUE)
+    set(TS_IP_TRANSPARENT ${CMAKE_MATCH_1})
+else()
+    if(ENABLE_TPROXY STREQUAL "AUTO")
+        set(TS_USE_TPROXY FALSE)
+    else()
+        message(FATAL_ERROR "ENABLE_TPROXY on but sockopt value not found")

Review Comment:
   Perhaps include the symbol name and file here for more information.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #9884: Add transparent proxy support to CMake build

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #9884:
URL: https://github.com/apache/trafficserver/pull/9884#issuecomment-1598870951

   Test "polite_hook_wait" failed with SIGSEGV (9) on first run.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on a diff in pull request #9884: Add transparent proxy support to CMake build

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on code in PR #9884:
URL: https://github.com/apache/trafficserver/pull/9884#discussion_r1235488785


##########
cmake/ConfigureTransparentProxy.cmake:
##########
@@ -0,0 +1,74 @@
+#######################
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+#  agreements.  See the NOTICE file distributed with this work for additional information regarding
+#  copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with the License.  You may obtain
+#  a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software distributed under the License
+#  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+#  or implied. See the License for the specific language governing permissions and limitations under
+#  the License.
+#
+#######################
+
+# ConfigureTransparentProxy.cmake
+#
+# The following variables should be set
+#
+#     ENABLE_TPROXY to one of AUTO, NO, or a number
+#     TS_USE_POSIX_CAP to a boolean value
+#
+# This will define the following variables
+#
+#     TS_USE_TPROXY
+#     TS_IP_TRANSPARENT
+#
+
+set(TS_IP_TRANSPARENT 0)
+
+if(ENABLE_TPROXY STREQUAL "NO")
+    set(TS_USE_TPROXY FALSE)
+    return()
+endif()
+
+if(NOT TS_USE_POSIX_CAP)
+    if(ENABLE_TPROXY STREQUAL "AUTO")
+        set(TS_USE_TPROXY FALSE)
+    else()
+        message(FATAL_ERROR "ENABLE_TPROXY requires POSIX capabilities.")
+    endif()
+    return()
+endif()
+
+if(ENABLE_TPROXY STREQUAL "FORCE")
+    set(TS_USE_TPROXY TRUE)
+    set(TS_IP_TRANSPARENT 19)
+    return()
+endif()
+
+if(ENABLE_TPROXY MATCHES "([0-9]+)")
+    set(TS_USE_TPROXY TRUE)
+    set(TS_IP_TRANSPARENT ${CMAKE_MATCH_1})
+    return()
+endif()
+
+# If the read fails, it will print out a confusing error. This
+# is to make it clear why the error is happening in that case.
+message("ENABLE_TPROXY enabled, looking for value in /usr/include/linux/in.h")
+file(READ "/usr/include/linux/in.h" HEADER_CONTENTS)
+if(HEADER_CONTENTS MATCHES "#define[ \t]+IP_TRANSPARENT[ \t]+([0-9]+)")
+    set(TS_USE_TPROXY TRUE)
+    set(TS_IP_TRANSPARENT ${CMAKE_MATCH_1})
+else()
+    if(ENABLE_TPROXY STREQUAL "AUTO")
+        set(TS_USE_TPROXY FALSE)
+    else()
+        message(FATAL_ERROR "ENABLE_TPROXY on but sockopt value not found")

Review Comment:
   The file name is printed out just before, but stating the symbol name is a great idea.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] bneradt merged pull request #9884: Add transparent proxy support to CMake build

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt merged PR #9884:
URL: https://github.com/apache/trafficserver/pull/9884


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org