Commit 2d6fea51 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/oc-docker-october-improvements' into ci-deploy-docker-compose

parents b29b8838 858a1dc0
...@@ -114,6 +114,8 @@ check_supported_distribution() { ...@@ -114,6 +114,8 @@ check_supported_distribution() {
"rhel7.7") return 0 ;; "rhel7.7") return 0 ;;
"rhel7.8") return 0 ;; "rhel7.8") return 0 ;;
"rhel8.2") return 0 ;; "rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
"rhel8.4") return 0 ;;
"centos7") return 0 ;; "centos7") return 0 ;;
esac esac
return 1 return 1
......
...@@ -32,6 +32,7 @@ WORKDIR /oai-ran ...@@ -32,6 +32,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --eNB --ninja -w USRP ./build_oai --eNB --ninja -w USRP
......
...@@ -33,6 +33,7 @@ WORKDIR /oai-ran ...@@ -33,6 +33,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --eNB --ninja -w USRP ./build_oai --eNB --ninja -w USRP
......
...@@ -32,9 +32,14 @@ WORKDIR /oai-ran ...@@ -32,9 +32,14 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --eNB --ninja -w USRP ./build_oai --eNB --ninja -w USRP
RUN apt-get install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/parameters.yaml
# debug # debug
#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
#RUN ls -ls /oai-ran/targets/bin #RUN ls -ls /oai-ran/targets/bin
...@@ -73,6 +78,7 @@ RUN apt-get update && \ ...@@ -73,6 +78,7 @@ RUN apt-get update && \
WORKDIR /opt/oai-enb/bin WORKDIR /opt/oai-enb/bin
COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 .
COPY --from=enb-build /oai-ran/docker/scripts/enb_entrypoint.sh entrypoint.sh
WORKDIR /usr/local/lib/ WORKDIR /usr/local/lib/
COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
...@@ -104,21 +110,17 @@ RUN ldconfig ...@@ -104,21 +110,17 @@ RUN ldconfig
# Copy the relevant configuration files for eNB # Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc WORKDIR /opt/oai-enb/etc
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* ./ COPY --from=enb-build /oai-ran/docker/etc .
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* ./
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* ./
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* ./
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* ./
WORKDIR /opt/oai-enb WORKDIR /opt/oai-enb
#EXPOSE 2152/udp # S1U, GTP/UDP # 2152 --> S1U, GTP/UDP
# 36412 --> S1C, SCTP/UDP
# 36422 --> X2C, SCTP/UDP
EXPOSE 2152/udp 36412/udp 36422/udp
#EXPOSE 22100/tcp # ? #EXPOSE 22100/tcp # ?
#EXPOSE 36412/udp # S1C, SCTP/UDP
#EXPOSE 36422/udp # X2C, SCTP/UDP
#EXPOSE 50000/udp # IF5 / ORI (control) #EXPOSE 50000/udp # IF5 / ORI (control)
#EXPOSE 50001/udp # IF5 / ECPRI (data) #EXPOSE 50001/udp # IF5 / ECPRI (data)
#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] CMD ["/opt/oai-enb/bin/lte-softmodem.Rel15", "-O", "/opt/oai-enb/etc/enb.conf"]
CMD ["sleep", "infinity"]
...@@ -32,6 +32,7 @@ WORKDIR /oai-ran ...@@ -32,6 +32,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --gNB --ninja -w USRP ./build_oai --gNB --ninja -w USRP
......
...@@ -33,6 +33,7 @@ WORKDIR /oai-ran ...@@ -33,6 +33,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --gNB --ninja -w USRP ./build_oai --gNB --ninja -w USRP
......
...@@ -32,6 +32,7 @@ WORKDIR /oai-ran ...@@ -32,6 +32,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --gNB --ninja -w USRP ./build_oai --gNB --ninja -w USRP
......
...@@ -33,6 +33,7 @@ WORKDIR /oai-ran ...@@ -33,6 +33,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP ./build_oai --UE --ninja -w USRP
......
...@@ -33,6 +33,7 @@ WORKDIR /oai-ran ...@@ -33,6 +33,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP ./build_oai --UE --ninja -w USRP
......
...@@ -32,6 +32,7 @@ WORKDIR /oai-ran ...@@ -32,6 +32,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP ./build_oai --UE --ninja -w USRP
......
...@@ -32,6 +32,7 @@ WORKDIR /oai-ran ...@@ -32,6 +32,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --nrUE --ninja -w USRP ./build_oai --nrUE --ninja -w USRP
......
...@@ -33,6 +33,7 @@ WORKDIR /oai-ran ...@@ -33,6 +33,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --nrUE --ninja -w USRP ./build_oai --nrUE --ninja -w USRP
......
...@@ -32,6 +32,7 @@ WORKDIR /oai-ran ...@@ -32,6 +32,7 @@ WORKDIR /oai-ran
#run build_oai to build the target image #run build_oai to build the target image
RUN /bin/sh oaienv && \ RUN /bin/sh oaienv && \
cd cmake_targets && \ cd cmake_targets && \
rm -Rf log && \
mkdir -p log && \ mkdir -p log && \
./build_oai --nrUE --ninja -w USRP ./build_oai --nrUE --ninja -w USRP
......
#!/bin/bash
set -euo pipefail
# Based another env var
if [[ -v USE_FDD_CU ]]; then ln -s /opt/oai-enb/etc/cu.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_DU ]]; then ln -s /opt/oai-enb/etc/du.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_TDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.tdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_RCC ]]; then ln -s /opt/oai-enb/etc/rcc.if4p5.enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_TDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.tdd.conf /opt/oai-enb/etc/enb.conf; fi
CONFIG_FILES=`ls /opt/oai-enb/etc/enb.conf`
for c in ${CONFIG_FILES}; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
# Later-on, how to add command lines options?
# Load the USRP binaries
# --> later conditional (when doing simulators)
/usr/lib/uhd/utils/uhd_images_downloader.py
exec "$@"
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
---
- paths:
source_dir: "ci-scripts/conf_files/"
dest_dir: docker/etc
- configurations:
- filePrefix: cu
outputfilename: "cu.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: plmn_list
env:
mcc: "@MCC@"
mnc: "@MNC@"
mnc_length: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: local_s_if_name
env: "@F1_IF_NAME@"
- key: remote_s_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_s_address
env: "@F1_CU_IP_ADDRESS@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- filePrefix: du
outputfilename: "du.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: plmn_list
env:
mcc: "@MCC@"
mnc: "@MNC@"
mnc_length: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: local_n_if_name
env: "@F1_IF_NAME@"
- key: remote_n_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_n_address
env: "@F1_CU_IP_ADDRESS@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- filePrefix: rru.fdd
outputfilename: "rru.fdd.conf"
config:
- key: local_if_name
env: "@@"
- key: remote_address
env: "@@"
- key: local_address
env: "@@"
- key: bands
env: "@@"
- filePrefix: rru.tdd
outputfilename: "rru.tdd.conf"
config:
- key: local_if_name
env: "@@"
- key: remote_address
env: "@@"
- key: local_address
env: "@@"
- key: bands
env: "@@"
- filePrefix: enb.band7.tm1.25PRB.usrpb210
outputfilename: "enb.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: plmn_list
env:
mcc: "@MCC@"
mnc: "@MNC@"
mnc_length: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- filePrefix: enb.band40.tm1.25PRB.FairScheduler.usrpb210
outputfilename: "enb.tdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: plmn_list
env:
mcc: "@MCC@"
mnc: "@MNC@"
mnc_length: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- filePrefix: "rcc.band7.tm1.nfapi"
outputfilename: "rcc.if4p5.enb.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
- key: eNB_name
env: "@ENB_NAME@"
- key: plmn_list
env:
mcc: "@MCC@"
mnc: "@MNC@"
mnc_length: "@MNC_LENGTH@"
- key: tracking_area_code
env: "@TAC@"
- key: local_s_if_name
env: "@F1_IF_NAME@"
- key: remote_s_address
env: "@F1_DU_IP_ADDRESS@"
- key: local_s_address
env: "@F1_CU_IP_ADDRESS@"
- key: eutra_band
env: "@UTRA_BAND_ID@"
- key: downlink_frequency
env: "@DL_FREQUENCY_IN_MHZ@000000"
- key: uplink_frequency_offset
env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
- key: Nid_cell
env: "@NID_CELL@"
- key: N_RB_DL
env: "@NB_PRB@"
- key: ipv4
env: "@MME_S1C_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1_MME
env: "@S1C_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1_MME
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_INTERFACE_NAME_FOR_S1U
env: "@S1U_IF_NAME@"
- key: ENB_IPV4_ADDRESS_FOR_S1U
env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#-----------------------------------------------------------
# Import
#-----------------------------------------------------------
import re
import yaml
import os
import sys
def main():
#read yaml input parameters
f = open(f'{sys.argv[1]}',)
data = yaml.full_load(f)
dir = os.listdir(f'{data[0]["paths"]["source_dir"]}')
#identify configs, read and replace corresponding values
for config in data[1]["configurations"]:
filePrefix = config["filePrefix"]
outputfilename = config["outputfilename"]
for inputfile in dir:
if inputfile.find(filePrefix) >=0:
prefix_outputfile = {"cu": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"du": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rru.fdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band7.tm1.25PRB.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band40.tm1.25PRB.FairScheduler.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}'
}
if filePrefix in prefix_outputfile:
outputfile1 = prefix_outputfile[filePrefix]
directory = f'{data[0]["paths"]["dest_dir"]}'
if not os.path.exists(directory):
os.makedirs(directory, exist_ok=True)
with open(f'{data[0]["paths"]["source_dir"]}{inputfile}', mode='r') as inputfile, \
open(outputfile1, mode='w') as outputfile:
for line in inputfile:
count = 0
for key in config["config"]:
if line.find(key["key"]) >= 0:
count += 1
if re.search(r'preference', line):
templine = line
elif re.search(r'plmn_list', line):
templine = re.sub(r'[0-9]+', '""', line)
templine = re.sub(r'\"\"', key["env"]["mcc"], templine, 1)
templine = re.sub(r'\"\"', key["env"]["mnc"], templine, 1)
templine = re.sub(r'\"\"', key["env"]["mnc_length"], templine, 1)
elif re.search('downlink_frequency', line):
templine = re.sub(r'[0-9]+', key["env"], line)
elif re.search('uplink_frequency_offset', line):
templine = re.sub(r'[0-9]+', key["env"], line)
elif re.search(r'"(.*?)"', line):
templine = re.sub(r'(?<=")[^"]*(?=")', key["env"], line)
elif re.search(r'[0-9]', line):
templine = re.sub(r'\d+', key["env"], line)
outputfile.write(templine)
if count == 0:
outputfile.write(line)
if __name__ == "__main__":
main()
...@@ -413,10 +413,16 @@ sctp_handle_new_association_req( ...@@ -413,10 +413,16 @@ sctp_handle_new_association_req(
} }
/* Subscribe to all events */ /* Subscribe to all events */
memset((void *)&events, 1, sizeof(struct sctp_event_subscribe)); events.sctp_data_io_event = 1;
events.sctp_association_event = 1;
events.sctp_address_event = 1;
events.sctp_send_failure_event = 1;
events.sctp_peer_error_event = 1;
events.sctp_shutdown_event = 1;
events.sctp_partial_delivery_event = 1;
if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &events, if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &events,
sizeof(struct sctp_event_subscribe)) < 0) { 8) < 0) {
SCTP_ERROR("Setsockopt IPPROTO_SCTP_EVENTS failed: %s\n", SCTP_ERROR("Setsockopt IPPROTO_SCTP_EVENTS failed: %s\n",
strerror(errno)); strerror(errno));
close(sd); close(sd);
...@@ -759,10 +765,16 @@ static int sctp_create_new_listener( ...@@ -759,10 +765,16 @@ static int sctp_create_new_listener(
} }
} }
memset((void *)&event, 1, sizeof(struct sctp_event_subscribe)); event.sctp_data_io_event = 1;
event.sctp_association_event = 1;
event.sctp_address_event = 1;
event.sctp_send_failure_event = 1;
event.sctp_peer_error_event = 1;
event.sctp_shutdown_event = 1;
event.sctp_partial_delivery_event = 1;
if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &event, if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &event,
sizeof(struct sctp_event_subscribe)) < 0) { 8) < 0) {
SCTP_ERROR("setsockopt: %s:%d\n", strerror(errno), errno); SCTP_ERROR("setsockopt: %s:%d\n", strerror(errno), errno);
if (sd != -1) { if (sd != -1) {
close(sd); close(sd);
......
...@@ -241,10 +241,16 @@ int sctp_connect_to_remote_host(char *local_ip_addr[], ...@@ -241,10 +241,16 @@ int sctp_connect_to_remote_host(char *local_ip_addr[],
} }
/* Subscribe to all events */ /* Subscribe to all events */
memset((void *)&events, 1, sizeof(struct sctp_event_subscribe)); events.sctp_data_io_event = 1;
events.sctp_association_event = 1;
events.sctp_address_event = 1;
events.sctp_send_failure_event = 1;
events.sctp_peer_error_event = 1;
events.sctp_shutdown_event = 1;
events.sctp_partial_delivery_event = 1;
if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &events, if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &events,
sizeof(struct sctp_event_subscribe)) < 0) { 8) < 0) {
SCTP_ERROR("Setsockopt IPPROTO_SCTP_EVENTS failed: %s\n", SCTP_ERROR("Setsockopt IPPROTO_SCTP_EVENTS failed: %s\n",
strerror(errno)); strerror(errno));
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment