Skip to content

Commit

Permalink
Enable dtls use on 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianSipos committed Nov 26, 2024
1 parent 6d29444 commit 25fe435
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,19 @@ where `gentype` of "fullvalid" generates valid BPv7 test bundles, and `gencount`
The `run.py` commands use the environment `DOCKER` to control the container tool.
For example in fedora use the environment `DOCKER="sudo podman"`.

To install prerequisites for python run:
```
pip3 install '.[container]'
```

To initialize and start a set of containers:
```
python3 container/run.py --config container/example.yaml delete prep start
```

To observe the log of one of the nodes:
```
docker container exec -it node003 journalctl -f
docker container exec -it node000 journalctl -f
```

To capture traffic across container networks, run similar to:
Expand All @@ -110,7 +115,7 @@ wireshark -i br-dtnA -i br-dtnB -f 'port 4556 or port 1113 or icmp' -Y 'bpv7' -k

To call DBus methods in one of the nodes:
```
docker container exec -it node003 dbus-send --system --print-reply --dest=org.ietf.dtn.node.udpcl /org/ietf/dtn/udpcl/Agent org.ietf.dtn.udpcl.Agent.pmtud_start string:node002. uint16:4556
docker container exec -it node000 dbus-send --system --print-reply --dest=org.ietf.dtn.node.udpcl /org/ietf/dtn/udpcl/Agent org.ietf.dtn.udpcl.Agent.pmtud_start string:node002. uint16:4556
```

To perform an ACME validation exchange between two nodes run the script:
Expand Down
8 changes: 8 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ RUN --mount=type=cache,target=/root/.cache/pip \
pip3 install --upgrade pip && \
pip3 install pip-tools maturin

# Work-around python3-dtls requiring openssl-1.1 but not available on 22.04
RUN --mount=type=cache,target=/var/cache/apt apt-get update && \
apt-get install -yq curl && \
curl -svLO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb && \
dpkg -i libssl1.1_*_amd64.deb && \
apt-get -fy install && \
rm libssl1.1_*_amd64.deb

COPY pyproject.toml /root/agent/
#RUN --mount=type=cache,target=/root/.cache/pip \
# cd /root/agent && \
Expand Down
6 changes: 6 additions & 0 deletions src/udpcl/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ def listen(self, address, port, opts=None):
sock = conv.make_local_socket()
self.__logger.info('Listening on %s:%d', conv.local_address, conv.local_port)

if conv.family == socket.AF_INET:
sock.setsockopt(socket.IPPROTO_IP, socket.IP_RECVTOS, 1)

multicast_member = opts.get('multicast_member', [])
for item in multicast_member:
addr = str(item['addr'])
Expand Down Expand Up @@ -692,6 +695,9 @@ def _sock_recvfrom(self, sock, *_args, **_kwargs):

self.__logger.info('Received %d octets via plain on %s',
len(data), conv)
for cmsg_level, cmsg_type, cmsg_data in ancdata:
if (cmsg_level, cmsg_type) == (socket.IPPROTO_IP, socket.IP_TOS):
self.__logger.info('With TOS field %02x', cmsg_data[0])
self._plain_sock[conv.key] = sock
self._recv_datagram(sock, data, conv, ip_tos)
return True
Expand Down

0 comments on commit 25fe435

Please sign in to comment.