Skip to content

Commit

Permalink
feat: add open-iscsi
Browse files Browse the repository at this point in the history
This adds open-iscsi.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
  • Loading branch information
andrewrynhard committed Jun 14, 2020
1 parent 125ce0e commit bce91be
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COMMON_ARGS := --file=Pkgfile
COMMON_ARGS += --progress=$(PROGRESS)
COMMON_ARGS += --platform=$(PLATFORM)

TARGETS = ca-certificates cni containerd dosfstools eudev fhs ipmitool iptables kernel kmod libaio libressl libseccomp linux-firmware lvm2 musl runc socat syslinux util-linux xfsprogs
TARGETS = ca-certificates cni containerd dosfstools eudev fhs ipmitool iptables kernel kmod libaio libressl libseccomp linux-firmware lvm2 musl open-iscsi open-isns runc socat syslinux util-linux xfsprogs

all: $(TARGETS) ## Builds all known pkgs.

Expand Down
81 changes: 81 additions & 0 deletions open-iscsi/patches/libressl-compatibility.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
diff -Naur open-iscsi-2.1.1.old/usr/auth.c open-iscsi-2.1.1.new/usr/auth.c
--- open-iscsi-2.1.1.old/usr/auth.c 2020-02-26 20:07:13.000000000 +0100
+++ open-iscsi-2.1.1.new/usr/auth.c 2020-05-16 14:54:46.240945323 +0200
@@ -182,9 +182,11 @@
case AUTH_CHAP_ALG_SHA256:
digest = EVP_sha256();
break;
+#ifndef LIBRESSL_VERSION_NUMBER
case AUTH_CHAP_ALG_SHA3_256:
digest = EVP_sha3_256();
break;
+#endif
}

if (*context == NULL)
@@ -335,7 +337,9 @@
acl_chk_chap_alg_optn(int chap_algorithm)
{
if (chap_algorithm == AUTH_OPTION_NONE ||
+#ifndef LIBRESSL_VERSION_NUMBER
chap_algorithm == AUTH_CHAP_ALG_SHA3_256 ||
+#endif
chap_algorithm == AUTH_CHAP_ALG_SHA256 ||
chap_algorithm == AUTH_CHAP_ALG_SHA1 ||
chap_algorithm == AUTH_CHAP_ALG_MD5)
@@ -748,9 +752,11 @@
case AUTH_CHAP_ALG_SHA256:
client->chap_challenge_len = AUTH_CHAP_SHA256_RSP_LEN;
break;
+#ifndef LIBRESSL_VERSION_NUMBER
case AUTH_CHAP_ALG_SHA3_256:
client->chap_challenge_len = AUTH_CHAP_SHA3_256_RSP_LEN;
break;
+#endif
}
return;
}
@@ -899,7 +905,10 @@
client->local_state = AUTH_LOCAL_STATE_ERROR;
client->dbg_status = AUTH_DBG_STATUS_CHAP_ALG_REJECT;
break;
- } else if ((client->negotiated_chap_alg != AUTH_CHAP_ALG_SHA3_256) &&
+ } else if (
+#ifndef LIBRESSL_VERSION_NUMBER
+ (client->negotiated_chap_alg != AUTH_CHAP_ALG_SHA3_256) &&
+#endif
(client->negotiated_chap_alg != AUTH_CHAP_ALG_SHA256) &&
(client->negotiated_chap_alg != AUTH_CHAP_ALG_SHA1) &&
(client->negotiated_chap_alg != AUTH_CHAP_ALG_MD5)) {
@@ -1849,6 +1858,7 @@
"SHA256 due to crypto lib configuration");
}
break;
+#ifndef LIBRESSL_VERSION_NUMBER
case AUTH_CHAP_ALG_SHA3_256:
if (EVP_DigestInit_ex(context, EVP_sha3_256(), NULL)) {
value_list[i++] = AUTH_CHAP_ALG_SHA3_256;
@@ -1857,6 +1867,7 @@
"SHA3-256 due to crypto lib configuration");
}
break;
+#endif
case ~0:
/* unset value in array, just ignore */
break;
diff -Naur open-iscsi-2.1.1.old/usr/auth.h open-iscsi-2.1.1.new/usr/auth.h
--- open-iscsi-2.1.1.old/usr/auth.h 2020-02-26 20:07:13.000000000 +0100
+++ open-iscsi-2.1.1.new/usr/auth.h 2020-05-16 14:53:37.189272729 +0200
@@ -67,8 +67,12 @@
AUTH_CHAP_ALG_MD5 = 5,
AUTH_CHAP_ALG_SHA1 = 6,
AUTH_CHAP_ALG_SHA256 = 7,
+#ifdef LIBRESSL_VERSION_NUMBER
+ AUTH_CHAP_ALG_MAX_COUNT = 4
+#else
AUTH_CHAP_ALG_SHA3_256 = 8,
AUTH_CHAP_ALG_MAX_COUNT = 5
+#endif
};

enum auth_neg_role {
24 changes: 24 additions & 0 deletions open-iscsi/patches/remove-werror.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff -ruN a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile
--- a/libopeniscsiusr/Makefile 2020-02-26 19:07:13.000000000 +0000
+++ b/libopeniscsiusr/Makefile 2020-06-14 16:18:18.882898020 +0000
@@ -44,7 +44,7 @@
OBJS = context.o misc.o session.o sysfs.o iface.o idbm.o node.o default.o

CFLAGS ?= -O2 -g
-CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC
+CFLAGS += -Wall -Wextra -fvisibility=hidden -fPIC
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)

LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod)
diff -ruN a/usr/Makefile b/usr/Makefile
--- a/usr/Makefile 2020-02-26 19:07:13.000000000 +0000
+++ b/usr/Makefile 2020-06-14 16:18:33.534919954 +0000
@@ -35,7 +35,7 @@
PKG_CONFIG = /usr/bin/pkg-config

CFLAGS ?= -O2 -g
-WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes -fno-common
+WARNFLAGS ?= -Wall -Wextra -Wstrict-prototypes -fno-common
CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \
-I$(TOPDIR)/libopeniscsiusr
CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod)
47 changes: 47 additions & 0 deletions open-iscsi/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: open-iscsi
variant: scratch
shell: /toolchain/bin/bash
dependencies:
- stage: base
- stage: kmod
- stage: open-isns
- stage: libressl
- stage: util-linux
steps:
- sources:
- url: https://github.com/open-iscsi/open-iscsi/archive/2.1.1.tar.gz
destination: open-iscsi.tar.gz
sha256: dfc1ea37f230f9d116f5b39c795b35be43002d65c81330ccd3878786532b811b
sha512: 88dbea433fe5266714c5c73ce4b60dfb8ddeffcaad4ff77abbdda2a865d29d4307ca51b8f45376f54542b19baed30d5f2f1836a8c136eb0af840f489f47e4fb3
prepare:
- |
tar -xzf open-iscsi.tar.gz --strip-components=1
# Create symlinks for binaries required by libtoolize.
ln -s /toolchain/bin/sed /bin/sed
ln -s /toolchain/bin/grep /bin/grep
# Create symlinks for files used when building.
mkdir -p /usr/bin
ln -s /toolchain/bin/pkg-config /usr/bin/pkg-config
ln -s /toolchain/bin/file /usr/bin/file
patch -p1 < /pkg/patches/remove-werror.patch
patch -p1 < /pkg/patches/libressl-compatibility.patch
build:
- |
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
make -j $(nproc) \
prefix=/usr \
exec_prefix=/usr \
localstatedir=/var \
sysconfdir=/etc \
mandir=/usr/share/man \
OPTFLAGS="$CFLAGS -DNO_SYSTEMD"
install:
- |
make prefix=/usr DESTDIR=/rootfs install
finalize:
- from: /rootfs
to: /
41 changes: 41 additions & 0 deletions open-isns/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: open-isns
variant: scratch
shell: /toolchain/bin/bash
dependencies:
- stage: base
- stage: libressl
steps:
- sources:
- url: https://github.com/open-iscsi/open-isns/archive/v0.100.tar.gz
destination: open-isns.tar.gz
sha256: b011edbb0f31690aaca902a8ecf4e1f17b01d6c9e9afc51909d26b0993b4328f
sha512: ccf49ba1c60d46ae49b75424a966abc1f7e104c8ffa13013951a58a8f0ccaa1cf550f24fd2743fcaba1211a0ec8033c5df5249b7a108ae5974d4f1144dd3b169
prepare:
- |
tar -xzf open-isns.tar.gz --strip-components=1
mkdir build
cd build
../configure \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-shared \
CFLAGS="$CFLAGS -Wno-error"
build:
- |
cd build
make -j $(nproc)
install:
- |
cd build
make DESTDIR=/rootfs install
make DESTDIR=/rootfs install_hdrs
make DESTDIR=/rootfs install_lib
rm -rf /rootfs/usr/lib/systemd
rm -rf /rootfs/usr/lib/*.a
finalize:
- from: /rootfs
to: /

0 comments on commit bce91be

Please sign in to comment.