Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
c9657e6
Consildate Ipv6 Features for Upstream
Sep 20, 2017
2ebaff7
Adding configuring the list of interfaces to be managed
Feb 16, 2018
26f9551
Adding configuring the list of interfaces to be managed
Feb 16, 2018
ab2422a
Adding configuration for the list of interfaces to be managed
Feb 16, 2018
a0ff2e5
Adding the allmulti flag to the network interface
Feb 16, 2018
87156d3
Update netif.c
metelik Feb 18, 2018
c200b8b
Update netif.c
metelik Feb 18, 2018
c5a76fe
Update netif.c
metelik Feb 18, 2018
578c73c
Merge pull request #1 from se-apc/bugfix/agilis-4190_limiting_managem…
metelik Feb 19, 2018
a511770
Restoring the previously removed code for ipv6 removal
Feb 21, 2018
5151f92
Demoting info debug-print to the debug level
Feb 21, 2018
1b2eb0b
Restoring the ipv6 address removal
Feb 21, 2018
0a6a702
Merge pull request #3 from se-apc/feature/removal_of_ipv6_address_res…
metelik Feb 22, 2018
cba4370
Code review re-work
Feb 22, 2018
a7ae4ce
Merge pull request #5 from se-apc/feature/removal_of_ipv6_address_res…
michaelkschmidt Feb 22, 2018
93f3ca2
Disabling debug prints
Feb 22, 2018
b087085
Added gateway removal interface function '-ipv6_gateway'
Mar 1, 2018
8f89c88
added removal of all gateways
Mar 2, 2018
97e4a42
Update netif.c
metelik Mar 5, 2018
e5b9fea
Merge pull request #6 from se-apc/feature/gateway_removal
metelik Mar 21, 2018
d408131
Remove IO.puts
adrigonzo Jun 18, 2018
fe4298a
Adding typespecs and debug prints
Mar 28, 2019
3a8dca6
Merge pull request #7 from se-apc/devel/adding_typespecs_and_debug_pr…
metelik Mar 28, 2019
2914e84
Correcting syntax error
Mar 29, 2019
b833584
Adding Logger requirement
Mar 29, 2019
e005fd9
Adding ipv6 related interface events' types
Mar 29, 2019
39064a3
Merge pull request #8 from se-apc/devel/adding_typespecs_and_debug_pr…
metelik Mar 29, 2019
56ed485
Removing the buffer overflow bug in the IPv6 addresses with prefix le…
Apr 8, 2019
b506592
Code review re-work
Apr 8, 2019
c0b705d
Merge pull request #9 from se-apc/bugfix/buffer_overflow_for_ipv6_wit…
metelik Apr 8, 2019
3132b44
Add wrapper around netif executable
Jun 28, 2019
e9ef0c4
fix permissions + don't try to kill dead pid
Jun 28, 2019
99f7e47
Use MuonTrap instead of shell script
Jul 1, 2019
516ea7d
Merge pull request #10 from se-apc/handle_zombie_processes
alanj853 Jul 1, 2019
34da894
update lock file
alanj853 Jul 1, 2019
987d1f1
downgrade to a tested version of muontrap
alanj853 Jul 1, 2019
6c1d481
Merge pull request #11 from se-apc/downgrade_muontrap
alanj853 Jul 1, 2019
950afed
Extending buffer size for erlang response
Sep 21, 2020
c8135b9
Using binary_to_term [:safe] plus adding an error handling
Sep 21, 2020
ee94a7e
Fixing syntax error missing )
Sep 21, 2020
51d61a1
Merge pull request #12 from se-apc/bugfix/buffer_overflow_for_max_ipv…
metelik Sep 21, 2020
881edf5
Rewritten add_default_gateway to use the rtnetlink
Jan 21, 2021
c4902cc
Re-implementing add_default_gateway to use the libmnl and call modern…
Jan 25, 2021
4ce422e
Commenting out the debug-macro definition
Jan 25, 2021
5242ee1
Merge pull request #14 from se-apc/devel/add_default_gw_libmnl
metelik Jan 25, 2021
bd17f10
Adding IPv4 address removal function
Feb 24, 2021
901fbac
Removing commented out code
Feb 24, 2021
7ac23bf
Re-adding function ACK
Feb 24, 2021
e862a07
Merge pull request #15 from se-apc/feature/ipv4_address_removal
metelik Feb 24, 2021
c814d12
Splitting the debug related declarations into separate header file
Mar 30, 2021
870117a
Splitting the debug related declarations into separate header file
Mar 30, 2021
3a96d16
Adding a handy Logger.debug entry
Mar 30, 2021
4834237
Trailing whitespace removal
Mar 30, 2021
7e1cd22
Muon trap v0.6.0
Mar 30, 2021
b4049b7
Removing commented out code
Mar 30, 2021
3dadf3e
Merge pull request #16 from se-apc/bugfix/handling_of_no_subnet_mask_…
metelik Mar 30, 2021
2b2dbaa
Update to OTP24 and Elixir 1.12.3
alanj853 Nov 16, 2021
272e2cb
Updating muon trap
Jan 12, 2022
83ccb5b
Update .tool-versions
alanj853 Jan 21, 2022
6ea2b38
:safe flag removed from handle_info for notifications from the netif …
Jul 1, 2022
4a5b6d6
MuonTrap update
Jul 1, 2022
fa940c8
Small code improvements; compilation warnings
Jul 1, 2022
4eef446
Unused variable compilation warning
Jul 1, 2022
7c961e1
The post-deugging clean-up
Jul 1, 2022
2307f5e
Removing unused variable
Jul 1, 2022
da9f0fe
Merge pull request #19 from se-apc/devel/small_refactor
metelik Jul 4, 2022
3df8196
Adding errno handling in add_default_gateway
Aug 8, 2022
be3e1dc
Merge pull request #20 from se-apc/bugfix/port_timeout_on_gateway_inv…
metelik Aug 8, 2022
b2f48a4
Enabling error debug printing
Jan 16, 2023
4617272
Merge pull request #21 from se-apc/devel/error_debug_prints
metelik Jan 16, 2023
b785e37
New warn(...) debug print
Jun 22, 2023
e376069
The ethtool link settings support
Jun 22, 2023
8d19bd6
Correcting typo
Jun 22, 2023
afd0a20
Merge pull request #22 from se-apc/devel/ethtool_link_settings_support
metelik Jun 22, 2023
14b84d1
Removing debug print
Jul 3, 2023
cd868ef
Merge pull request #23 from se-apc/devel/removing_debug_print
metelik Jul 27, 2023
56951dd
Adding info on ernno to IPv6 add default gw IOCTL
Nov 17, 2023
41a2ca3
Merge pull request #24 from se-apc/devel/more_debug_info_for_v6_gw_ioctl
metelik Nov 17, 2023
736df8b
Upgrade to 1.16.3 OTP 26.2.5
alanj853 Jun 20, 2024
caca29c
Merge pull request #25 from se-apc/1.16.3-otp-26.2.5-branch
alanj853 Sep 24, 2024
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
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
elixir 1.16.3-otp-26
erlang 26.2.5
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ else
CFLAGS += -std=gnu99
endif

#We need this for netinet/in.h IN6_* macros
CFLAGS += -D_GNU_SOURCE

# If not cross-compiling, then run sudo by default
ifeq ($(origin CROSSCOMPILE), undefined)
SUDO_ASKPASS ?= /usr/bin/ssh-askpass
Expand Down
9 changes: 9 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Config

#config :nerves_network_interface, :managed_interfaces,
# ["eth0", "ens38"]

# Other possible configurations:
# 1. Manage all available interfaces - explicitly said implicit equivalen of no :managed interfaces provided
# config :nerves_network_interface, :managed_interfaces,
# "all"
92 changes: 92 additions & 0 deletions lib/nerves_network_interface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

defmodule Nerves.NetworkInterface do

require Logger

@moduledoc """
This module exposes a simplified view of Linux network configuration to
applications.
Expand All @@ -34,6 +36,68 @@ defmodule Nerves.NetworkInterface do
ensure that the port process is running as a privileged user.
"""

@type interface_name :: String.t
@type registration ::
{:ok, pid} |
{:error, {:already_registered, pid}}

@type operstate ::
:unknown
| :notpresent
| :down
| :lowerlayerdown
| :testing
| :dormant
| :up

@type ipv4_address :: String.t()
@type ipv6_address :: String.t()

@type dhcpv6_mode ::
:stateful
| :stateless

@type ifsettings_ipv4 :: %{
ifname: Nerves.NetworkInterface.interface_name(),
domain: String.t(),
ipv4_address: ipv4_address(),
ipv4_broadcast: ipv4_address(),
ipv4_gateway: ipv4_address(),
ipv4_subnet_mask: ipv4_address(),
nameservers: list(ipv4_address())
}

@type ifsettings_ipv6 :: %{
ifname: Nerves.NetworkInterface.interface_name(),
ipv6_domain: String.t(),
ipv6_address: ipv6_address(),
ipv6_nameservers: list(ipv6_address()),
old_ipv6_address: ipv6_address(),
dhcpv6_mode: dhcpv6_mode()
}

@type ifstatus :: %{
ifname: Nerves.NetworkInterface.interface_name(),
index: integer(),
"is_all-multicast": boolean(),
is_broadcast: boolean(),
is_lower_up: boolean(),
is_multicast: boolean(),
is_running: boolean(),
is_up: boolean(),
mac_address: String.t(),
mac_broadcast: String.t(),
mtu: integer(),
operstate: operstate(),
type: :ethernet | :other
}

@type ifevent ::
ifstatus()
| ifsettings_ipv4()
| ifsettings_ipv6()


@doc """
Return the list of network interfaces on this machine.
"""
Expand Down Expand Up @@ -93,4 +157,32 @@ defmodule Nerves.NetworkInterface do
Returns `:ok` on success or `{:error, reason}` if an error occurs.
"""
defdelegate setup(ifname, options), to: Nerves.NetworkInterface.Worker

@doc """
Register for Nerves.NetworkInterface events on a specific interface

The calling process is the process that will be registered for
all events. The events can be handled by implementing a `handle_info\2`.

`def handle_info({Nerves.NetworkInterface, :ifchanged, ifstate} = event, state)`

Use :all to register for events from all interfaces.

The registration registers for messages dispatched out of `Registry`.

For information on how `Registry` works please see that module's
documentation.
"""
@spec register(:all | interface_name) ::
registration |
[registration] |
[]
def register(:all) do
Enum.each(interfaces(), &register/1)
end

def register(ifname) do
Logger.debug("Registering for notifications for #{ifname}...")
Registry.register(Nerves.NetworkInterface, ifname, [])
end
end
5 changes: 2 additions & 3 deletions lib/network_interface/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ defmodule Nerves.NetworkInterface.Application do
use Application

def start(_type, _args) do
import Supervisor.Spec, warn: false

children = [
supervisor(Registry, [:duplicate, Nerves.NetworkInterface]),
worker(Nerves.NetworkInterface.Worker, []),
%{id: Registry, start: {Registry, :start_link, [[keys: :duplicate, name: Nerves.NetworkInterface]]}},
%{id: Nerves.NetworkInterface.Worker, start: {Nerves.NetworkInterface.Worker, :start_link, []}}
]

opts = [strategy: :rest_for_one, name: Nerves.NervesInterface.Supervisor]
Expand Down
56 changes: 49 additions & 7 deletions lib/network_interface/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ defmodule Nerves.NetworkInterface.Worker do
is_broadcast: boolean,
is_lower_up: boolean,
is_multicast: boolean,
"is_all-multicast": boolean,
is_up: boolean,
is_running: boolean,
mac_address: mac_address,
Expand Down Expand Up @@ -118,15 +119,43 @@ defmodule Nerves.NetworkInterface.Worker do
end

def init([]) do
Logger.info "Start Network Interface Worker"
Logger.warning "Start Network Interface Worker"
executable = :code.priv_dir(:nerves_network_interface) ++ '/netif'
port = Port.open({:spawn_executable, executable},
[{:packet, 2}, :use_stdio, :binary])
port = Port.open({:spawn_executable, to_charlist(MuonTrap.muontrap_path())},
[{:args, ["--", executable]}, {:packet, 2}, :use_stdio, :binary])
{ :ok, %Nerves.NetworkInterface.Worker{port: port} }
end

#Returns intersection of lists a and b
defp intersect(a, b), do: a -- (a -- b)

# Returns list of interfaces to be managed by Nerves.NetworkInterface and Nerves.Network modules
# By default this is list of ALL network interfaces available in the system. It can be reduced
# by specifying a list of interfaces we want to be managed by Nerves.Network sub-system in the
# .../config/config.exs file.
defp get_managed_interfaces(available_interfaces) do
managed_interfaces = Application.get_env(:nerves_network_interface, :managed_interfaces, [])
Logger.debug "#{__MODULE__}: managed_interfaces = #{inspect managed_interfaces}"

case managed_interfaces do
"all" -> available_interfaces
nil -> available_interfaces
[] -> available_interfaces
_ -> managed_interfaces
end
end

def handle_call(:all_interfaces, _from, state) do
available_interfaces = call_port(state, :interfaces, [])
{:reply, available_interfaces, state }
end

def handle_call(:interfaces, _from, state) do
response = call_port(state, :interfaces, [])
available_interfaces = call_port(state, :interfaces, [])
response =
get_managed_interfaces(available_interfaces)
|> intersect(available_interfaces)
Logger.debug "#{__MODULE__}: response: #{inspect response}"
{:reply, response, state }
end
def handle_call({:status, ifname}, _from, state) do
Expand All @@ -142,6 +171,8 @@ defmodule Nerves.NetworkInterface.Worker do
{:reply, response, state }
end
def handle_call({:setup, ifname, options}, _from, state) do
Logger.debug(":setup #{ifname} options = #{inspect options}")

response = call_port(state, :setup, {ifname, options})
{:reply, response, state }
end
Expand All @@ -154,14 +185,25 @@ defmodule Nerves.NetworkInterface.Worker do
{:stop, :normal, state}
end

def handle_info({_, {:data, <<?n, message::binary>>}}, state) do
{notif, data} = :erlang.binary_to_term(message)
Logger.info "nerves_network_interface received #{inspect notif} and #{inspect data}"
def dispatch(notif, data) do
Logger.debug "nerves_network_interface received #{inspect notif} and #{inspect data}"
Registry.dispatch(Nerves.NetworkInterface, data.ifname, fn entries ->
for {pid, _} <- entries do
Logger.debug("Dispatching for pid = #{inspect pid} notif = #{inspect notif} data = #{inspect data}")
Logger.debug("Process info for pid = #{inspect pid}: #{inspect Process.info(pid)}")

send(pid, {Nerves.NetworkInterface, notif, data})
end
end)
end

def handle_info({_, _input = {:data, <<?n, message::binary>>}}, state) do
try do
{notif, data} = :erlang.binary_to_term(message)
dispatch(notif, data)
rescue
e -> Logger.error("Error converting to term: #{inspect e}!")
end
{:noreply, state}
end

Expand Down
6 changes: 5 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ defmodule Nerves.NetworkInterface.Mixfile do
defp deps do
[{:dialyxir, ">= 0.0.0", only: [:dev, :test]},
{:elixir_make, "~> 0.4", runtime: false},
{:ex_doc, "~> 0.11", only: :dev}]
{:ex_doc, "~> 0.11", only: :dev},

## netif doesn't seem to work with later versions of muontrap
{:muontrap, "~> 1.0.0"}
]
end
end
17 changes: 13 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
%{"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [], [], "hexpm"},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], [], "hexpm"},
"elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.18.1", "37c69d2ef62f24928c1f4fdc7c724ea04aecfdf500c4329185f8e3649c915baf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}}
%{
"dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], [], "hexpm", "3b1dcad3067985dd8618c38399a8ee9c4e652d52a17a4aae7a6d6fc4fcc24856"},
"earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"},
"elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.34.0", "ab95e0775db3df71d30cf8d78728dd9261c355c81382bcd4cefdc74610bef13e", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "60734fb4c1353f270c3286df4a0d51e65a2c1d9fba66af3940847cc65a8066d7"},
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"},
"muontrap": {:hex, :muontrap, "1.0.0", "53a05c37f71cc5070aaa0858a774ae1f500160b7186a70565521a14ef7843c5a", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0d3cd6e335986f9c2af1b61f583375b0f0d91cea95b7ec7bc720f330b4dc9b49"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
}
45 changes: 45 additions & 0 deletions src/debug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/****************************************************************
* Copyright (C) 2021 Schneider Electric *
****************************************************************/

#if !defined(__DEBUG_H__)
#define __DEBUG_H__

//#define DEBUG
//#define INFO
#define WARN
#define ERROR

#ifdef DEBUG
#define debug(format, ...) fprintf(stderr, "DBG: "format, __VA_ARGS__); fprintf(stderr, "\r\n")
#define debugf(string) fprintf(stderr, string); fprintf(stderr, "\r\n")
#else
#define debug(format, ...)
#define debugf(string)
#endif

#ifdef INFO
#define info(format, ...) fprintf(stderr, "INFO: "format, __VA_ARGS__); fprintf(stderr, "\r\n")
#define infof(string) fprintf(stderr, string); fprintf(stderr, "\r\n")
#else
#define info(format, ...)
#define infof(string)
#endif

#ifdef WARN
#define warn(format, ...) fprintf(stderr, "WARN: "format, __VA_ARGS__); fprintf(stderr, "\r\n")
#define warnf(string) fprintf(stderr, string); fprintf(stderr, "\r\n")
#else
#define warn(format, ...)
#define warnf(string)
#endif

#ifdef ERROR
#define error(format, ...) fprintf(stderr, "ERROR:"format, __VA_ARGS__); fprintf(stderr, "\r\n")
#define errorf(string) fprintf(stderr, string); fprintf(stderr, "\r\n")
#else
#define error(format, ...)
#define errorf(string)
#endif

#endif
15 changes: 14 additions & 1 deletion src/erlcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,21 @@ int erlcmd_encode_errno_error(char *buf, int *index, int err)
case EROFS: reason = "erofs"; break;
case EMLINK: reason = "emlink"; break;
case EPIPE: reason = "epipe"; break;
case ENETDOWN: reason = "enetdown"; break;
case ENETUNREACH: reason = "enetunreach"; break;
case ENETRESET: reason = "enetreset"; break;
case ECONNABORTED: reason = "econnaborted"; break;
case ECONNRESET: reason = "econnreset"; break;
case EADDRNOTAVAIL: reason = "eaddrnotavail"; break;
default: reason = "unknown"; break;
case ENOBUFS: reason = "enobufs"; break;
case EISCONN: reason = "eisconn"; break;
case ENOTCONN: reason = "enotconn"; break;
case ETOOMANYREFS: reason = "etoomanyrefs"; break;
case ETIMEDOUT: reason = "etimedout"; break;
case ECONNREFUSED: reason = "econnrefused"; break;
case EHOSTDOWN: reason = "ehostdown"; break;
case EHOSTUNREACH: reason = "ehostunreach"; break;
default: reason = "unknown"; break;
}
return erlcmd_encode_error_tuple(buf, index, reason);
}
Expand Down
6 changes: 5 additions & 1 deletion src/erlcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
/*
* Erlang request/response processing
*/
#define ERLCMD_BUF_SIZE 1024
/*
* The IPv6 addresses' is a variable length list - th 16kB is enough to hold
* net.ipv6.conf.eth0.max_addresses=16.
*/
#define ERLCMD_BUF_SIZE 1024*16
struct erlcmd
{
char buffer[ERLCMD_BUF_SIZE];
Expand Down
Loading