git: 5f28f9cbd40f - main - net/dtcp: make dtcp work with Ruby 3.X.

From: Hajimu UMEMOTO <ume_at_FreeBSD.org>
Date: Thu, 21 Apr 2022 17:56:36 UTC
The branch main has been updated by ume:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5f28f9cbd40f6f7fa68a1e73e47a7e0c1e015d79

commit 5f28f9cbd40f6f7fa68a1e73e47a7e0c1e015d79
Author:     Hajimu UMEMOTO <ume@FreeBSD.org>
AuthorDate: 2022-04-21 17:55:07 +0000
Commit:     Hajimu UMEMOTO <ume@FreeBSD.org>
CommitDate: 2022-04-21 17:56:25 +0000

    net/dtcp: make dtcp work with Ruby 3.X.
---
 net/dtcp/Makefile             |  2 +-
 net/dtcp/files/patch-dtcpc.rb | 43 +++++++++++++++++++++++++---------
 net/dtcp/files/patch-dtcps.rb | 54 +++++++++++++++++++++++++++++++++----------
 3 files changed, 75 insertions(+), 24 deletions(-)

diff --git a/net/dtcp/Makefile b/net/dtcp/Makefile
index c97b6ff91027..860bb086068d 100644
--- a/net/dtcp/Makefile
+++ b/net/dtcp/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	dtcp
 PORTVERSION=	20130602
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	net
 MASTER_SITES=	http://www.mahoroba.org/~ume/ipv6/
 
diff --git a/net/dtcp/files/patch-dtcpc.rb b/net/dtcp/files/patch-dtcpc.rb
index a63ead05b960..e6395dd936e6 100644
--- a/net/dtcp/files/patch-dtcpc.rb
+++ b/net/dtcp/files/patch-dtcpc.rb
@@ -1,8 +1,6 @@
-Index: dtcpc.rb
-diff -u dtcpc.rb.orig dtcpc.rb
---- dtcpc.rb.orig	2013-06-02 23:05:51.000000000 +0900
-+++ dtcpc.rb	2014-05-22 17:24:50.852383194 +0900
-@@ -422,6 +422,10 @@
+--- dtcpc.rb.orig	2013-06-02 14:05:51 UTC
++++ dtcpc.rb
+@@ -422,6 +422,10 @@ class Interface
      execute("ifconfig #{@name} mtu #{mtu}")
    end
  
@@ -13,7 +11,7 @@ diff -u dtcpc.rb.orig dtcpc.rb
    def linklocal
      `ifconfig #{@name} inet6`.each_line { |s|
        if s =~ /inet6 (fe80::[^ ]*)/
-@@ -461,6 +465,9 @@
+@@ -461,6 +465,9 @@ class ClonedInterface < Interface
  	end
        }
      end
@@ -23,7 +21,7 @@ diff -u dtcpc.rb.orig dtcpc.rb
      @created = true
    end
  
-@@ -520,6 +527,9 @@
+@@ -520,6 +527,9 @@ class NetgraphInterface < Interface
      if !@tunif || @tunif == "ng"
        @name = mkpeer
        @created = true
@@ -33,7 +31,12 @@ diff -u dtcpc.rb.orig dtcpc.rb
        return
      end
  
-@@ -535,6 +545,9 @@
+@@ -531,10 +541,13 @@ class NetgraphInterface < Interface
+     shutdown(@tunif)
+ 
+     bogus = Array.new
+-    while TRUE
++    while true
        @name = mkpeer
        if @name == @tunif
  	@created = true
@@ -43,7 +46,16 @@ diff -u dtcpc.rb.orig dtcpc.rb
  	break
        end
  
-@@ -927,6 +940,7 @@
+@@ -899,7 +912,7 @@ class DTCPClient
+ 
+   def keep_alive(sock)
+     begin
+-      while TRUE
++      while true
+ 	debugmsg("sleep(60)\n")
+ 	sleep 60
+ 	sendmsg(sock, "ping")
+@@ -927,6 +940,7 @@ ousername = username
  password = ''
  tunif = TUNIF
  cloning = TUNIF_CLONING
@@ -51,7 +63,7 @@ diff -u dtcpc.rb.orig dtcpc.rb
  tuntype = 'tunnelonly'
  route_type = 'static'
  static_routes = 'default'
-@@ -949,7 +963,7 @@
+@@ -949,7 +963,7 @@ pidfile = PIDFILE
  # exit 0
  
  begin
@@ -60,7 +72,7 @@ diff -u dtcpc.rb.orig dtcpc.rb
  rescue
    usage()
    exit 0
-@@ -965,6 +979,7 @@
+@@ -965,6 +979,7 @@ cloning = false if params["c"]
  $debug = params["d"]
  daemonize = params["D"]
  pidfile = params["f"] if params["f"]
@@ -68,3 +80,12 @@ diff -u dtcpc.rb.orig dtcpc.rb
  tunif = params["i"] if params["i"]
  loop = params["l"]
  mtu = params["m"].to_i if params["m"]
+@@ -1013,7 +1028,7 @@ begin
+ 			      rtadvd_disable)
+     dtcpc = DTCPClient.new(dst, port, username, password, tuntype, behind_nat,
+ 			   mtu, udp_tunnel, udp_tunnel_port)
+-    while TRUE
++    while true
+       interrupt = nil
+       begin
+ 	trap("SIGHUP") {
diff --git a/net/dtcp/files/patch-dtcps.rb b/net/dtcp/files/patch-dtcps.rb
index bea1832ee408..a12c07ecf5c5 100644
--- a/net/dtcp/files/patch-dtcps.rb
+++ b/net/dtcp/files/patch-dtcps.rb
@@ -1,8 +1,6 @@
-Index: dtcps.rb
-diff -u dtcps.rb.orig dtcps.rb
---- dtcps.rb.orig	2013-06-02 23:05:51.000000000 +0900
-+++ dtcps.rb	2014-05-22 17:24:50.868385076 +0900
-@@ -185,6 +185,18 @@
+--- dtcps.rb.orig	2013-06-02 14:05:51 UTC
++++ dtcps.rb
+@@ -185,6 +185,18 @@ class Interface
      execute("ifconfig #{@name} mtu #{mtu}")
    end
  
@@ -21,7 +19,7 @@ diff -u dtcps.rb.orig dtcps.rb
    def linklocal
      `ifconfig #{@name} inet6`.each_line { |s|
        if s =~ /inet6 (fe80::[^ ]*)/
-@@ -226,6 +238,9 @@
+@@ -226,6 +238,9 @@ class ClonedInterface < Interface
  	end
        }
      end
@@ -31,7 +29,7 @@ diff -u dtcps.rb.orig dtcps.rb
      @created = true
    end
  
-@@ -291,6 +306,9 @@
+@@ -291,6 +306,9 @@ class NetgraphInterface < Interface
      if !@tunif || @tunif == "ng"
        @name = mkpeer
        @created = true
@@ -41,7 +39,12 @@ diff -u dtcps.rb.orig dtcps.rb
        return
      end
  
-@@ -306,6 +324,9 @@
+@@ -302,10 +320,13 @@ class NetgraphInterface < Interface
+     shutdown(@tunif)
+ 
+     bogus = Array.new
+-    while TRUE
++    while true
        @name = mkpeer
        if @name == @tunif
  	@created = true
@@ -51,7 +54,7 @@ diff -u dtcps.rb.orig dtcps.rb
  	break
        end
  
-@@ -724,6 +745,7 @@
+@@ -724,6 +745,7 @@ class Tunnel
        }
        delpeer(@tunif, @info[3], @info[2])
      end
@@ -59,7 +62,7 @@ diff -u dtcps.rb.orig dtcps.rb
      _delete(@tunif)
      @tunif = nil
    end
-@@ -769,6 +791,7 @@
+@@ -769,6 +791,7 @@ class Tunnel
        raise 'tunnel interface sold out'
      end
      debugmsg("#{s}: tunnel interface #{tunif.name}\n")
@@ -67,7 +70,34 @@ diff -u dtcps.rb.orig dtcps.rb
  
      myaddr = nil
      if type == 'host' || (type == 'network' && $network_with_peeraddr)
-@@ -1173,13 +1196,14 @@
+@@ -883,7 +906,7 @@ end
+ def checktraffic(tun)
+   return if TRAFFICTIMEOUT == 0
+   ipkts = getipkts(tun.name)
+-  while TRUE
++  while true
+     sleep TRAFFICTIMEOUT
+     i = getipkts(tun.name)
+     next if i == -1
+@@ -899,7 +922,7 @@ end
+ 
+ def service_dtcp(sock, name)
+   debugmsg("service_dtcp(#{sock}, #{name})\n")
+-  while TRUE
++  while true
+     debugmsg("service_dtcp(#{sock}, #{name}) accepting\n")
+     Thread.start(sock.accept) { |s|
+       debugmsg("service_dtcp(#{sock}, #{name}) accepted #{s}\n")
+@@ -912,7 +935,7 @@ def service_dtcp(sock, name)
+ 
+       # check response
+       # tunnel itojun RESPONSE type
+-      while TRUE
++      while true
+ 	t = IO.select([s], [], [s], tun == nil ? AUTHTIMEOUT : TUNTIMEOUT)
+ 	if t == nil
+ 	  s.print "-ERR connection timed out, disconnecting\r\n"
+@@ -1173,13 +1196,14 @@ port = 20200
  $tunif = TUNIF
  $ng_tunif = "ng"
  $cloning = TUNIF_CLONING
@@ -83,7 +113,7 @@ diff -u dtcps.rb.orig dtcps.rb
  rescue
    usage()
    exit 0
-@@ -1190,6 +1214,7 @@
+@@ -1190,6 +1214,7 @@ $udp_tunnel_port = params["b"].to_i if params["b"]
  $cloning = false if params["c"]
  $debug = params["d"]
  $daemonize = !params["D"]