~mamarley/openconnect/+git/gitlab-main:freebsd

Last commit made on 2023-05-19
Get this branch:
git clone -b freebsd https://git.launchpad.net/~mamarley/openconnect/+git/gitlab-main

Branch merges

Branch information

Name:
freebsd
Repository:
lp:~mamarley/openconnect/+git/gitlab-main

Recent commits

f6d2c8d... by dwmw2

os-tcp-mtu.c: Explicitly include <netinet/in.h> for sockaddr_in(6|)

This doesn't get pulled in automatically in FreeBSD.

Signed-off-by: David Woodhouse <email address hidden>

0b47190... by dwmw2

Use extended regular expressions in gensymbols.sed

Using 'sed -E', along with a few other tweaks, makes it work on FreeBSD.

Signed-off-by: David Woodhouse <email address hidden>

4ca0aa1... by dwmw2

Clean up ifreq_set_ifname() and use it from bsd_open_tun() too

Currently, if we set a name with --interface which is too long to fit in
ifr->ifr_name, it gets silently truncated with strncpy(). This in itself
is not immediately broken, although the FreeBSD build does complain:

tun.c:262:17: warning: 'strncpy' output may be truncated copying 15 bytes from a string of length 74 [-Wstringop-truncation]
  262 | strncpy(ifr.ifr_name, tun_name + 5, sizeof(ifr.ifr_name) - 1);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It's not *immediately* broken, and there are no string overflows; the NUL
termination is there anyway. But it *is* broken eventually, because we'll
spawn vpnc-script with the *originally* intended name, and it won't find
the device with that name.

So fix it up to check the length and then return an error if the requested
name is too long, and just use memcpy() to put the string into ifr_name,
which was pre-zeroed anyway.

Signed-off-by: David Woodhouse <email address hidden>

af717f3... by dwmw2

Always define 'environ' in POSIX systems

POSIX.1-2017 says we should explicitly declare 'extern char **environ'
for ourselves. FreeBSD does need it too, as well as Solaris.

Signed-off-by: David Woodhouse <email address hidden>

dd4e7b0... by dwmw2

Fix unaligned accesses in ESP checksum calculation

The FreeBSD 14 build complains:

gpst.c: In function 'gpst_esp_send_probes':
gpst.c:1512:57: warning: taking address of packed member of 'struct ip6_hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
 1512 | uint32_t sum = csum_partial((uint16_t *)&iph->ip6_src, 8); /* 8 uint16_t */
      | ^~~~~~~~~~~~~
gpst.c:1513:49: warning: taking address of packed member of 'struct ip6_hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
 1513 | sum += csum_partial((uint16_t *)&iph->ip6_dst, 8); /* 8 uint16_t */
      | ^~~~~~~~~~~~~
gpst.c:1525:17: warning: converting a packed 'struct icmp6_hdr' pointer (alignment 1) to a 'uint16_t' {aka 'short unsigned int'} pointer (alignment 2) may result in an unaligned pointer value [-Waddress-of-packed-member]
 1525 | sum += csum_partial((uint16_t *)icmph, icmplen / 2);
      | ^~~

Rather than loading a potentially unaligned uint16_t directly, use
load_be16() instead. And pass (void *) pointers around instead of
(uint16_t *).

Signed-off-by: David Woodhouse <email address hidden>

8d8a336... by dwmw2

Fix link to OpenBSD port

Signed-off-by: David Woodhouse <email address hidden>

fd7050e... by dwmw2

Disable explict setting of IP_PMTUDISC_DO on MacOS

Fixes: #612
Signed-off-by: David Woodhouse <email address hidden>

eb890eb... by dwmw2

Fix time_t handling in parsing F5 session timeout

We can't assume that time_t is 'long'. When building for win64 we get:
../f5.c: In function 'f5_configure':
../f5.c:690:63: warning: format '%ld' expects argument of type 'long int *', but argument 6 has type 'time_t *' {aka 'long long int *'} [-Wformat=]
  690 | if (sscanf(cookie->value, "%dz%dz%dz%ldz%ld%c", &junk, &junk, &junk, &start, &dur, &c) >= 5
      | ~~^ ~~~~~~
      | | |
      | long int * time_t * {aka long long int *}
      | %lld
../f5.c:690:67: warning: format '%ld' expects argument of type 'long int *', but argument 7 has type 'time_t *' {aka 'long long int *'} [-Wformat=]
  690 | if (sscanf(cookie->value, "%dz%dz%dz%ldz%ld%c", &junk, &junk, &junk, &start, &dur, &c) >= 5
      | ~~^ ~~~~
      | | |
      | long int * time_t * {aka long long int *}
      | %lld

Make it explicitly 'unsigned long long' instead.

Signed-off-by: David Woodhouse <email address hidden>

8820b0a... by dwmw2

Merge branch 'optipng' of gitlab.com:openconnect/openconnect

eb479cf... by Dimitri Papadopoulos <email address hidden>

Ignore non-sensical NBNS/WINS server address

A VPN server sent the non-sensical NBNS/WINS server IP address 0.0.0.0.
I assume this is the default value in the VPN configuration. If so, it
could happen again. Do not pass this invalid default value to the script.

[ dwmw2: Add changelog ]
Signed-off-by: Dimitri Papadopoulos <email address hidden>
Signed-off-by: David Woodhouse <email address hidden>