William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 1 | SUMMARY = "Configures ncsi for a gBMC system" |
| 2 | PR = "r1" |
| 3 | LICENSE = "Apache-2.0" |
| 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" |
| 5 | |
| 6 | inherit systemd |
| 7 | |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 8 | SRC_URI += " \ |
| 9 | file://50-gbmc-ncsi.rules.in \ |
| 10 | file://gbmc-ncsi-sslh.socket.in \ |
| 11 | file://gbmc-ncsi-sslh.service \ |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 12 | file://gbmc-ncsi-nft.sh.in \ |
William A. Kennington III | e99168a | 2021-03-10 23:40:47 -0800 | [diff] [blame] | 13 | file://gbmc-ncsi-br-pub-addr.sh.in \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 14 | " |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 15 | |
| 16 | S = "${WORKDIR}" |
| 17 | |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 18 | RDEPENDS_${PN} += " \ |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 19 | gbmc-ip-monitor \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 20 | ncsid \ |
| 21 | nftables-systemd \ |
| 22 | sslh \ |
| 23 | " |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 24 | |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 25 | FILES_${PN} += " \ |
| 26 | ${datadir}/gbmc-ip-monitor \ |
| 27 | ${systemd_unitdir} \ |
| 28 | " |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 29 | |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 30 | SYSTEMD_SERVICE_${PN} += " \ |
| 31 | gbmc-ncsi-sslh.service \ |
| 32 | gbmc-ncsi-sslh.socket \ |
| 33 | " |
| 34 | |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 35 | do_install_append() { |
| 36 | if_name='${GBMC_NCSI_IF_NAME}' |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 37 | if [ -z "$if_name" ]; then |
| 38 | echo "Missing if_name" >&2 |
| 39 | exit 1 |
| 40 | fi |
| 41 | |
| 42 | install -d -m0755 ${D}${sysconfdir}/sysctl.d |
| 43 | echo "net.ipv6.conf.$if_name.accept_dad=0" \ |
| 44 | >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf |
| 45 | echo "net.ipv6.conf.$if_name.dad_transmits=0" \ |
| 46 | >>${D}${sysconfdir}/sysctl.d/25-gbmc-ncsi.conf |
| 47 | |
| 48 | netdir=${D}${systemd_unitdir}/network/00-bmc-$if_name.network.d |
| 49 | install -d -m0755 "$netdir" |
| 50 | echo '[Network]' >>"$netdir"/gbmc-ncsi.conf |
| 51 | echo 'DHCP=false' >>"$netdir"/gbmc-ncsi.conf |
| 52 | echo 'IPv6AcceptRA=false' >>"$netdir"/gbmc-ncsi.conf |
| 53 | echo 'LLMNR=false' >>"$netdir"/gbmc-ncsi.conf |
| 54 | echo 'MulticastDNS=false' >>"$netdir"/gbmc-ncsi.conf |
| 55 | echo 'LinkLocalAddressing=ipv6' >>"$netdir"/gbmc-ncsi.conf |
| 56 | |
| 57 | nftdir=${D}${sysconfdir}/nftables |
| 58 | install -d -m0755 "$nftdir" |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 59 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/50-gbmc-ncsi.rules.in \ |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 60 | >"$nftdir"/50-gbmc-ncsi.rules |
| 61 | |
| 62 | wantdir=${D}${systemd_system_unitdir}/multi-user.target.wants |
| 63 | install -d -m0755 "$wantdir" |
| 64 | ln -sv ../ncsid@.service "$wantdir"/ncsid@$if_name.service |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 65 | |
| 66 | install -m 0644 ${WORKDIR}/gbmc-ncsi-sslh.service ${D}${systemd_system_unitdir} |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 67 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-sslh.socket.in \ |
William A. Kennington III | 7f11d1f | 2021-02-16 14:57:41 -0800 | [diff] [blame] | 68 | >${D}${systemd_system_unitdir}/gbmc-ncsi-sslh.socket |
William A. Kennington III | 1ef795b | 2021-03-10 18:59:12 -0800 | [diff] [blame] | 69 | |
| 70 | mondir=${D}${datadir}/gbmc-ip-monitor/ |
| 71 | install -d -m0755 $mondir |
| 72 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-nft.sh.in \ |
| 73 | >${WORKDIR}/gbmc-ncsi-nft.sh |
| 74 | install -m644 ${WORKDIR}/gbmc-ncsi-nft.sh $mondir |
William A. Kennington III | e99168a | 2021-03-10 23:40:47 -0800 | [diff] [blame] | 75 | sed "s,@NCSI_IF@,$if_name,g" ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh.in \ |
| 76 | >${WORKDIR}/gbmc-ncsi-br-pub-addr.sh |
| 77 | install -m644 ${WORKDIR}/gbmc-ncsi-br-pub-addr.sh $mondir |
William A. Kennington III | f19a838 | 2021-02-16 14:16:47 -0800 | [diff] [blame] | 78 | } |