Damans227 commented on code in PR #13795:
URL: https://github.com/apache/cloudstack/pull/13795#discussion_r4158493317
##########
systemvm/debian/opt/cloud/bin/setup/common.sh:
##########
@@ -573,10 +573,42 @@ setup_dnsmasq() {
fi
}
+enable_ipv6_link_local() {
+ local eth=$1
+ log_it "Enabling IPv6 link-local on interface $eth"
+ # Generate the link-local address with EUI-64 based on the MAC address so
+ # the address can be calculated by the Management Server
+ sysctl -w net.ipv6.conf.${eth}.addr_gen_mode=0
+ # Only a link-local address is wanted, no SLAAC/RA configuration
+ sysctl -w net.ipv6.conf.${eth}.accept_ra=0
+ sysctl -w net.ipv6.conf.${eth}.autoconf=0
+ sysctl -w net.ipv6.conf.${eth}.disable_ipv6=0
+
+ # Wait for Duplicate Address Detection to complete so the address can be
bound
+ LINK_LOCAL_IP6=""
+ local i
+ for i in $(seq 1 10); do
+ LINK_LOCAL_IP6=$(ip -6 addr show dev ${eth} scope link -tentative | grep
-Po '(?<=inet6 )fe80:[0-9a-f:]+' | head -1)
+ [ -n "$LINK_LOCAL_IP6" ] && break
+ sleep 1
+ done
+
+ if [ -n "$LINK_LOCAL_IP6" ]; then
+ log_it "Interface $eth has IPv6 link-local address $LINK_LOCAL_IP6"
+ else
+ log_it "No IPv6 link-local address appeared on interface $eth"
+ fi
+}
+
setup_sshd(){
local ip=$1
local eth=$2
- [ -f /etc/ssh/sshd_config ] && sed -i -e
"s/^[#]*ListenAddress.*$/ListenAddress $ip/" /etc/ssh/sshd_config
+ [ -f /etc/ssh/sshd_config ] && sed -i -e "/^ListenAddress fe80/d" -e
"s/^[#]*ListenAddress.*$/ListenAddress $ip/" /etc/ssh/sshd_config
+ enable_ipv6_link_local $eth
+ if [ -n "$LINK_LOCAL_IP6" ]; then
+ log_it "Configuring sshd to also listen on ${LINK_LOCAL_IP6}%${eth}"
+ sed -i -e "/^ListenAddress $ip$/a ListenAddress ${LINK_LOCAL_IP6}%${eth}"
/etc/ssh/sshd_config
Review Comment:
fair enough, ok to fix that separately
##########
server/src/main/java/com/cloud/api/ApiResponseHelper.java:
##########
@@ -1886,6 +1886,9 @@ public SystemVmResponse
createSystemVmResponse(VirtualMachine vm) {
vmResponse.setLinkLocalIp(singleNicProfile.getIPv4Address());
vmResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
vmResponse.setLinkLocalNetmask(singleNicProfile.getIPv4Netmask());
+ if (singleNicProfile.getMacAddress() != null) {
+
vmResponse.setLinkLocalIp6(NetUtils.ipv6LinkLocal(singleNicProfile.getMacAddress()).toString());
Review Comment:
makes sense that it never changes. can we say in the field description that
its calculated, so nobody reads it as the address being up?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]