Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with linux #2

Merged
merged 16 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ help:
@echo ""
@echo " help outputs this helper"
@echo " build builds the project using Docker"
@echo " dev runs secc, mqtt and redis in dev version, using Docker"
@echo " run runs secc, mqtt and redis in prod version, using Docker"
@echo " dev runs secc and redis in dev version, using Docker"
@echo " run runs secc and redis in prod version, using Docker"
@echo " install-local uses poetry to update and install iso15118 locally, including dependencies"
@echo " run-secc runs the secc project locally"
@echo " run-evcc runs the evcc project locally"
Expand Down
13 changes: 0 additions & 13 deletions docker-compose-host-mode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,21 @@ services:
hostname: secc
build:
context: .
args:
- PYPI_USER=${PYPI_USER}
- PYPI_PASS=${PYPI_PASS}
dockerfile: iso15118/secc/Dockerfile
depends_on:
- mqtt
- redis
network_mode: host

evcc:
hostname: evcc
build:
context: .
args:
- PYPI_USER=${PYPI_USER}
- PYPI_PASS=${PYPI_PASS}
dockerfile: iso15118/evcc/Dockerfile
depends_on:
- mqtt
- redis
- secc
network_mode: host

mqtt:
build: ./mqtt
ports:
- "9001:9001"

redis:
image: redis:6.2.6-alpine
ports:
Expand Down
16 changes: 8 additions & 8 deletions iso15118/evcc/transport/udp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def _create_socket() -> 'socket':
This method creates an IPv6 socket configured to send multicast datagrams
"""

# raises an exception if the interface chosen is invalid
validate_nic(NETWORK_INTERFACE)

# Initialise the socket for IPv6 datagrams
# Address family (determines network layer protocol, here IPv6)
# Socket type (datagram, determines transport layer protocol UDP)
Expand All @@ -63,14 +66,11 @@ def _create_socket() -> 'socket':
ttl = struct.pack("@i", 1)
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, ttl)

# The IP_MULTICAST_IF or IPV6_MULTICAST_IF settings tell the socket to
# which interface shall send its multicast packets. It's a separate,
# independent, setting from the interface that bounds the socket to
# with bind(), since bind() controls which interface(s) the socket
# receives multicast packets from.

validate_nic(NETWORK_INTERFACE)

# Restrict multicast operation to the given interface
# The IP_MULTICAST_IF or IPV6_MULTICAST_IF settings, tell the socket
tropxy marked this conversation as resolved.
Show resolved Hide resolved
# which interface it shall send its multicast packets. It can be seen
# as the dual of bind(), since bind() controls which interface(s) the
tropxy marked this conversation as resolved.
Show resolved Hide resolved
# socket receives multicast packets from.
interface_index = socket.if_nametoindex(NETWORK_INTERFACE)
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, interface_index)

Expand Down
2 changes: 1 addition & 1 deletion iso15118/shared/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def get_tcp_port() -> int:
def get_nic_mac_address(nic: str) -> str:
"""
This method returns the MAC Addess of a specific NIC or the first one
associated with a IPv6 link-local address.
associated with an IPv6 link-local address.
Args:
nic (str): The Network Interface Card

Expand Down