On 12.06.2018 10:52, Bjørn Mork wrote:
> Igor Scheller <debian@igorscheller.de> writes:
>
> From 6bff2dee11a8d5493f87ec541f854e3897ef6a9a Mon Sep 17 00:00:00 2001
>> From: Igor Scheller <igor.scheller@igorshp.de>
>> Date: Mon, 11 Jun 2018 23:52:37 +0200
>> Subject: [PATCH] Added support for fe80 addresses as gateway
>>
>> ---
>> netcfg-common.c | 5 ++++-
>> static.c | 3 ++-
>> test/test_netcfg_gateway_reachable.c | 24 ++++++++++++++++++++++++
>> 3 files changed, 30 insertions(+), 2 deletions(-)
>>
>> diff --git a/netcfg-common.c b/netcfg-common.c
>> index c6d1d8d5..007c1875 100644
>> --- a/netcfg-common.c
>> +++ b/netcfg-common.c
>> @@ -1677,8 +1677,11 @@ int netcfg_gateway_reachable(const struct netcfg_interface *interface)
>> if (interface->address_family == AF_INET) {
>> return (gw_addr.in4.s_addr && ((gw_addr.in4.s_addr & mask.in4.s_addr) == net.in4.s_addr));
>> } else if (interface->address_family == AF_INET6) {
>> + if ((ntohs(gw_addr.in6.s6_addr32[0]) & 0xffc0) == (0xfe80 & 0xffc0)) {
>> + return 1;
>> + }
>> +
>> int i;
>> -
>> for (i = 0; i < 4; i++) {
>> if ((gw_addr.in6.s6_addr32[i] & mask.in6.s6_addr32[i]) != net.in6.s6_addr32[i]) {
>> return 0;
Jup, thats true but my programming skills are not good enough to
implement that so this was the first option that came to my mind.
> Or did I misunderstand what this code tries to do?
That's exactly what it does, same for the default behavior in the for
loop below.
Imho it could be a better option to just configure the interface and
test if something is reachable?
> Bjørn
Attachment:
signature.asc
Description: OpenPGP digital signature