GNS3 / ubridge

Bridge for UDP tunnels, Ethernet, TAP and VMnet interfaces.
GNU General Public License v3.0
114 stars 46 forks source link

SIGHUP leads to segfault on 0.9.18 on Ubuntu 22.04. #83

Closed fhaftmann closed 1 year ago

fhaftmann commented 1 year ago

Ubridge version: 0.9.18 OS: Ubuntu 22.04. Package repo: https://ppa.launchpadcontent.net/gns3/ppa/ubuntu OS package version: 0.9.18-1~jammy1

Given a systemd user session unit ubridge.service

[Unit]
Description=User space network bridges

[Service]
Type=simple
ExecStart=ubridge
WorkingDirectory=<Directory with ubridge.ini>
ExecReload=kill -HUP $MAINPID

a

systemctl --user reload ubridge.service

will (not always, but often) lead to a segfault

ubridge.service: Main process exited, code=dumped, status=11/SEGV
ubridge.service: Failed with result 'core-dump'.

without further error indication in the journal (systemctl --user status ubridge.service)

A systemctl --user restart ubridge.service will bring ubridge up again without problems.

What is going on here?

grossmj commented 1 year ago

Do you have a log for ubridge? Have you tried to send the SIGHUP signal manually using kill -s HUP <pid>?

fhaftmann commented 1 year ago

The core dump happens also when leaving out the systemd-wrapup, just by manually starting ubridge and then sending HUP manually.

When ubridge is started, it just confirms the configuration

uBridge version 0.9.18 running with libpcap version 1.10.1 (with TPACKET_V3)
Parsing server-00-p01_switch-01-p10
Creating UDP tunnel 40001:127.0.0.1:50001
UDP tunnel connecting from local port 40001 to IPv4 address 127.0.0.1 on port 50001
Creating UDP tunnel 41110:127.0.0.1:51110
UDP tunnel connecting from local port 41110 to IPv4 address 127.0.0.1 on port 51110
Parsing server-00-p02_switch-01-p20
Creating UDP tunnel 40002:127.0.0.1:50002
UDP tunnel connecting from local port 40002 to IPv4 address 127.0.0.1 on port 50002
Creating UDP tunnel 41120:127.0.0.1:51120
UDP tunnel connecting from local port 41120 to IPv4 address 127.0.0.1 on port 51120
Parsing server-01-p01_switch-01-p01
Creating UDP tunnel 40101:127.0.0.1:50101
UDP tunnel connecting from local port 40101 to IPv4 address 127.0.0.1 on port 50101
Creating UDP tunnel 41101:127.0.0.1:51101
UDP tunnel connecting from local port 41101 to IPv4 address 127.0.0.1 on port 51101
Parsing server-01-p02_switch-01-p11
Creating UDP tunnel 40102:127.0.0.1:50102
UDP tunnel connecting from local port 40102 to IPv4 address 127.0.0.1 on port 50102
Creating UDP tunnel 41111:127.0.0.1:51111
UDP tunnel connecting from local port 41111 to IPv4 address 127.0.0.1 on port 51111
Parsing server-02-p01_switch-01-p02
Creating UDP tunnel 40201:127.0.0.1:50201
UDP tunnel connecting from local port 40201 to IPv4 address 127.0.0.1 on port 50201
Creating UDP tunnel 41102:127.0.0.1:51102
UDP tunnel connecting from local port 41102 to IPv4 address 127.0.0.1 on port 51102
Parsing server-02-p02_switch-01-p12
Creating UDP tunnel 40202:127.0.0.1:50202
UDP tunnel connecting from local port 40202 to IPv4 address 127.0.0.1 on port 50202
Creating UDP tunnel 41112:127.0.0.1:51112
UDP tunnel connecting from local port 41112 to IPv4 address 127.0.0.1 on port 51112
Parsing server-03-p01_switch-01-p03
Creating UDP tunnel 40301:127.0.0.1:50301
UDP tunnel connecting from local port 40301 to IPv4 address 127.0.0.1 on port 50301
Creating UDP tunnel 41103:127.0.0.1:51103
UDP tunnel connecting from local port 41103 to IPv4 address 127.0.0.1 on port 51103
Parsing server-03-p02_switch-01-p13
Creating UDP tunnel 40302:127.0.0.1:50302
UDP tunnel connecting from local port 40302 to IPv4 address 127.0.0.1 on port 50302
Creating UDP tunnel 41113:127.0.0.1:51113
UDP tunnel connecting from local port 41113 to IPv4 address 127.0.0.1 on port 51113
Parsing server-04-p01_switch-01-p04
Creating UDP tunnel 40401:127.0.0.1:50401
UDP tunnel connecting from local port 40401 to IPv4 address 127.0.0.1 on port 50401
Creating UDP tunnel 41104:127.0.0.1:51104
UDP tunnel connecting from local port 41104 to IPv4 address 127.0.0.1 on port 51104
Parsing server-04-p02_switch-01-p14
Creating UDP tunnel 40402:127.0.0.1:50402
UDP tunnel connecting from local port 40402 to IPv4 address 127.0.0.1 on port 50402
Creating UDP tunnel 41114:127.0.0.1:51114
UDP tunnel connecting from local port 41114 to IPv4 address 127.0.0.1 on port 51114
Parsing server-05-p01_switch-01-p05
Creating UDP tunnel 40501:127.0.0.1:50501
UDP tunnel connecting from local port 40501 to IPv4 address 127.0.0.1 on port 50501
Creating UDP tunnel 41105:127.0.0.1:51105
UDP tunnel connecting from local port 41105 to IPv4 address 127.0.0.1 on port 51105
Parsing server-05-p02_switch-01-p15
Creating UDP tunnel 40502:127.0.0.1:50502
UDP tunnel connecting from local port 40502 to IPv4 address 127.0.0.1 on port 50502
Creating UDP tunnel 41115:127.0.0.1:51115
UDP tunnel connecting from local port 41115 to IPv4 address 127.0.0.1 on port 51115
Parsing server-06-p01_switch-01-p06
Creating UDP tunnel 40601:127.0.0.1:50601
UDP tunnel connecting from local port 40601 to IPv4 address 127.0.0.1 on port 50601
Creating UDP tunnel 41106:127.0.0.1:51106
UDP tunnel connecting from local port 41106 to IPv4 address 127.0.0.1 on port 51106
Parsing server-06-p02_switch-01-p16
Creating UDP tunnel 40602:127.0.0.1:50602
UDP tunnel connecting from local port 40602 to IPv4 address 127.0.0.1 on port 50602
Creating UDP tunnel 41116:127.0.0.1:51116
UDP tunnel connecting from local port 41116 to IPv4 address 127.0.0.1 on port 51116
Parsing uplink-virbr-cluster_switch-01-p19
Creating UDP tunnel 41119:127.0.0.1:51119
UDP tunnel connecting from local port 41119 to IPv4 address 127.0.0.1 on port 51119
Opening TAP device venv-sw-01-19
create_nio_tap: unable to open TAP device venv-sw-01-19 (Device or resource busy)
unable to open TAP device
Parsing uplink-virbr-mgmt_switch-01-p09
Creating UDP tunnel 41109:127.0.0.1:51109
UDP tunnel connecting from local port 41109 to IPv4 address 127.0.0.1 on port 51109
Opening TAP device venv-sw-01-09
create_nio_tap: unable to open TAP device venv-sw-01-09 (Device or resource busy)
unable to open TAP device
Source NIO listener thread for server-06-p02_switch-01-p16 has started
Destination NIO listener thread for server-06-p02_switch-01-p16 has started
Source NIO listener thread for server-06-p01_switch-01-p06 has started
Destination NIO listener thread for server-06-p01_switch-01-p06 has started
Source NIO listener thread for server-05-p02_switch-01-p15 has started
Destination NIO listener thread for server-05-p02_switch-01-p15 has started
Source NIO listener thread for server-05-p01_switch-01-p05 has started
Destination NIO listener thread for server-05-p01_switch-01-p05 has started
Source NIO listener thread for server-04-p02_switch-01-p14 has started
Destination NIO listener thread for server-04-p02_switch-01-p14 has started
Source NIO listener thread for server-04-p01_switch-01-p04 has started
Destination NIO listener thread for server-04-p01_switch-01-p04 has started
Source NIO listener thread for server-03-p02_switch-01-p13 has started
Destination NIO listener thread for server-03-p02_switch-01-p13 has started
Source NIO listener thread for server-03-p01_switch-01-p03 has started
Destination NIO listener thread for server-03-p01_switch-01-p03 has started
Source NIO listener thread for server-02-p02_switch-01-p12 has started
Destination NIO listener thread for server-02-p02_switch-01-p12 has started
Source NIO listener thread for server-02-p01_switch-01-p02 has started
Destination NIO listener thread for server-02-p01_switch-01-p02 has started
Source NIO listener thread for server-01-p02_switch-01-p11 has started
Destination NIO listener thread for server-01-p02_switch-01-p11 has started
Source NIO listener thread for server-01-p01_switch-01-p01 has started
Destination NIO listener thread for server-01-p01_switch-01-p01 has started
Source NIO listener thread for server-00-p02_switch-01-p20 has started
Source NIO listener thread for server-00-p01_switch-01-p10 has started
Destination NIO listener thread for server-00-p02_switch-01-p20 has started
Destination NIO listener thread for server-00-p01_switch-01-p10 has started
Reloading configuration
Parsing server-00-p01_switch-01-p10
Creating UDP tunnel 40001:127.0.0.1:50001
UDP tunnel connecting from local port 40001 to IPv4 address 127.0.0.1 on port 50001
Creating UDP tunnel 41110:127.0.0.1:51110
UDP tunnel connecting from local port 41110 to IPv4 address 127.0.0.1 on port 51110
Parsing server-00-p02_switch-01-p20
Creating UDP tunnel 40002:127.0.0.1:50002
UDP tunnel connecting from local port 40002 to IPv4 address 127.0.0.1 on port 50002
Creating UDP tunnel 41120:127.0.0.1:51120
UDP tunnel connecting from local port 41120 to IPv4 address 127.0.0.1 on port 51120
Parsing server-01-p01_switch-01-p01
Creating UDP tunnel 40101:127.0.0.1:50101
UDP tunnel connecting from local port 40101 to IPv4 address 127.0.0.1 on port 50101
Creating UDP tunnel 41101:127.0.0.1:51101
UDP tunnel connecting from local port 41101 to IPv4 address 127.0.0.1 on port 51101
Parsing server-01-p02_switch-01-p11
Creating UDP tunnel 40102:127.0.0.1:50102
UDP tunnel connecting from local port 40102 to IPv4 address 127.0.0.1 on port 50102
Creating UDP tunnel 41111:127.0.0.1:51111
UDP tunnel connecting from local port 41111 to IPv4 address 127.0.0.1 on port 51111
Parsing server-02-p01_switch-01-p02
Creating UDP tunnel 40201:127.0.0.1:50201
UDP tunnel connecting from local port 40201 to IPv4 address 127.0.0.1 on port 50201
Creating UDP tunnel 41102:127.0.0.1:51102
UDP tunnel connecting from local port 41102 to IPv4 address 127.0.0.1 on port 51102
Parsing server-02-p02_switch-01-p12
Creating UDP tunnel 40202:127.0.0.1:50202
UDP tunnel connecting from local port 40202 to IPv4 address 127.0.0.1 on port 50202
Creating UDP tunnel 41112:127.0.0.1:51112
UDP tunnel connecting from local port 41112 to IPv4 address 127.0.0.1 on port 51112
Parsing server-03-p01_switch-01-p03
Creating UDP tunnel 40301:127.0.0.1:50301
UDP tunnel connecting from local port 40301 to IPv4 address 127.0.0.1 on port 50301
Creating UDP tunnel 41103:127.0.0.1:51103
UDP tunnel connecting from local port 41103 to IPv4 address 127.0.0.1 on port 51103
Parsing server-03-p02_switch-01-p13
Creating UDP tunnel 40302:127.0.0.1:50302
UDP tunnel connecting from local port 40302 to IPv4 address 127.0.0.1 on port 50302
Creating UDP tunnel 41113:127.0.0.1:51113
UDP tunnel connecting from local port 41113 to IPv4 address 127.0.0.1 on port 51113
Parsing server-04-p01_switch-01-p04
Creating UDP tunnel 40401:127.0.0.1:50401
UDP tunnel connecting from local port 40401 to IPv4 address 127.0.0.1 on port 50401
Creating UDP tunnel 41104:127.0.0.1:51104
UDP tunnel connecting from local port 41104 to IPv4 address 127.0.0.1 on port 51104
Parsing server-04-p02_switch-01-p14
Creating UDP tunnel 40402:127.0.0.1:50402
UDP tunnel connecting from local port 40402 to IPv4 address 127.0.0.1 on port 50402
Creating UDP tunnel 41114:127.0.0.1:51114
UDP tunnel connecting from local port 41114 to IPv4 address 127.0.0.1 on port 51114
Parsing server-05-p01_switch-01-p05
Creating UDP tunnel 40501:127.0.0.1:50501
UDP tunnel connecting from local port 40501 to IPv4 address 127.0.0.1 on port 50501
Creating UDP tunnel 41105:127.0.0.1:51105
UDP tunnel connecting from local port 41105 to IPv4 address 127.0.0.1 on port 51105
Parsing server-05-p02_switch-01-p15
Creating UDP tunnel 40502:127.0.0.1:50502
UDP tunnel connecting from local port 40502 to IPv4 address 127.0.0.1 on port 50502
Creating UDP tunnel 41115:127.0.0.1:51115
UDP tunnel connecting from local port 41115 to IPv4 address 127.0.0.1 on port 51115
Parsing server-06-p01_switch-01-p06
Creating UDP tunnel 40601:127.0.0.1:50601
UDP tunnel connecting from local port 40601 to IPv4 address 127.0.0.1 on port 50601
Creating UDP tunnel 41106:127.0.0.1:51106
UDP tunnel connecting from local port 41106 to IPv4 address 127.0.0.1 on port 51106
Parsing server-06-p02_switch-01-p16
Creating UDP tunnel 40602:127.0.0.1:50602
UDP tunnel connecting from local port 40602 to IPv4 address 127.0.0.1 on port 50602
Creating UDP tunnel 41116:127.0.0.1:51116
UDP tunnel connecting from local port 41116 to IPv4 address 127.0.0.1 on port 51116
Parsing uplink-virbr-cluster_switch-01-p19
Creating UDP tunnel 41119:127.0.0.1:51119
UDP tunnel connecting from local port 41119 to IPv4 address 127.0.0.1 on port 51119
Opening TAP device venv-sw-01-19
Parsing uplink-virbr-mgmt_switch-01-p09
Creating UDP tunnel 41109:127.0.0.1:51109
UDP tunnel connecting from local port 41109 to IPv4 address 127.0.0.1 on port 51109
Opening TAP device venv-sw-01-09
Source NIO listener thread for uplink-virbr-mgmt_switch-01-p09 has started
Destination NIO listener thread for uplink-virbr-mgmt_switch-01-p09 has started
Source NIO listener thread for server-06-p02_switch-01-p16 has started
Destination NIO listener thread for server-06-p02_switch-01-p16 has started
Source NIO listener thread for server-05-p01_switch-01-p05 has started
Destination NIO listener thread for server-05-p01_switch-01-p05 has started
Source NIO listener thread for server-04-p02_switch-01-p14 has started
Source NIO listener thread for server-06-p01_switch-01-p06 has started
Destination NIO listener thread for server-04-p02_switch-01-p14 has started
Source NIO listener thread for server-05-p02_switch-01-p15 has started
Source NIO listener thread for server-03-p02_switch-01-p13 has started
Destination NIO listener thread for server-04-p01_switch-01-p04 has started
Source NIO listener thread for server-04-p01_switch-01-p04 has started
Destination NIO listener thread for server-03-p02_switch-01-p13 has started
Source NIO listener thread for server-03-p01_switch-01-p03 has started
Destination NIO listener thread for server-03-p01_switch-01-p03 has started
Source NIO listener thread for server-02-p02_switch-01-p12 has started
Destination NIO listener thread for server-02-p02_switch-01-p12 has started
Source NIO listener thread for server-02-p01_switch-01-p02 has started
Destination NIO listener thread for server-02-p01_switch-01-p02 has started
Source NIO listener thread for server-01-p02_switch-01-p11 has started
Destination NIO listener thread for server-01-p02_switch-01-p11 has started
Source NIO listener thread for server-01-p01_switch-01-p01 has started
Source NIO listener thread for server-00-p02_switch-01-p20 has started
Destination NIO listener thread for server-00-p02_switch-01-p20 has started
Source NIO listener thread for server-00-p01_switch-01-p10 has started
Destination NIO listener thread for server-00-p01_switch-01-p10 has started

and then works normally until the kill -s HUP …, when it core dumps without any further output.

Are there any debug or log switches one can use?

fhaftmann commented 1 year ago

The ubridge.ini reads

[server-00-p01_switch-01-p10]
source_udp = 40001:127.0.0.1:50001
destination_udp = 41110:127.0.0.1:51110

[server-00-p02_switch-01-p20]
source_udp = 40002:127.0.0.1:50002
destination_udp = 41120:127.0.0.1:51120

[server-01-p01_switch-01-p01]
source_udp = 40101:127.0.0.1:50101
destination_udp = 41101:127.0.0.1:51101

[server-01-p02_switch-01-p11]
source_udp = 40102:127.0.0.1:50102
destination_udp = 41111:127.0.0.1:51111

[server-02-p01_switch-01-p02]
source_udp = 40201:127.0.0.1:50201
destination_udp = 41102:127.0.0.1:51102

[server-02-p02_switch-01-p12]
source_udp = 40202:127.0.0.1:50202
destination_udp = 41112:127.0.0.1:51112

[server-03-p01_switch-01-p03]
source_udp = 40301:127.0.0.1:50301
destination_udp = 41103:127.0.0.1:51103

[server-03-p02_switch-01-p13]
source_udp = 40302:127.0.0.1:50302
destination_udp = 41113:127.0.0.1:51113

[server-04-p01_switch-01-p04]
source_udp = 40401:127.0.0.1:50401
destination_udp = 41104:127.0.0.1:51104

[server-04-p02_switch-01-p14]
source_udp = 40402:127.0.0.1:50402
destination_udp = 41114:127.0.0.1:51114

[server-05-p01_switch-01-p05]
source_udp = 40501:127.0.0.1:50501
destination_udp = 41105:127.0.0.1:51105

[server-05-p02_switch-01-p15]
source_udp = 40502:127.0.0.1:50502
destination_udp = 41115:127.0.0.1:51115

[server-06-p01_switch-01-p06]
source_udp = 40601:127.0.0.1:50601
destination_udp = 41106:127.0.0.1:51106

[server-06-p02_switch-01-p16]
source_udp = 40602:127.0.0.1:50602
destination_udp = 41116:127.0.0.1:51116

[uplink-virbr-cluster_switch-01-p19]
source_udp = 41119:127.0.0.1:51119
destination_tap = venv-sw-01-19

[uplink-virbr-mgmt_switch-01-p09]
source_udp = 41109:127.0.0.1:51109
destination_tap = venv-sw-01-09
fhaftmann commented 1 year ago

See now https://github.com/GNS3/ubridge/pull/85 for an analysis and proposal.

grossmj commented 1 year ago

Thanks for PR https://github.com/GNS3/ubridge/pull/85, do you confirm it solves this issue?

fhaftmann commented 1 year ago

Yes, it resolves the issue.