Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dockers/docker-iccpd/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y ebtables
RUN apt-get -y install -f kmod

COPY \
{% for deb in docker_iccpd_debs.split(' ') -%}
Expand Down
12 changes: 10 additions & 2 deletions rules/docker-iccpd.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# docker image for iccpd agent

DOCKER_ICCPD = docker-iccpd.gz
$(DOCKER_ICCPD)_PATH = $(DOCKERS_PATH)/docker-iccpd
DOCKER_ICCPD_STEM = docker-iccpd
DOCKER_ICCPD = $(DOCKER_ICCPD_STEM).gz
DOCKER_ICCPD_DBG = $(DOCKER_ICCPD_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_ICCPD)_PATH = $(DOCKERS_PATH)/$(DOCKER_ICCPD_STEM)
$(DOCKER_ICCPD)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(ICCPD)
$(DOCKER_ICCPD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_ICCPD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG) $(ICCPD_DBG)
$(DOCKER_ICCPD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)
$(DOCKER_ICCPD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)

ifeq ($(ENABLE_ICCPD), y)
SONIC_DOCKER_IMAGES += $(DOCKER_ICCPD)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ICCPD)
SONIC_STRETCH_DOCKERS += $(DOCKER_ICCPD)
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_ICCPD_DBG)
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_ICCPD_DBG)
SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_ICCPD_DBG)
endif

$(DOCKER_ICCPD)_CONTAINER_NAME = iccpd
Expand Down
14 changes: 10 additions & 4 deletions rules/iccpd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ ICCPD = iccpd_$(ICCPD_VERSION)_$(CONFIGURED_ARCH).deb
$(ICCPD)_DEPENDS += $(LIBNL_GENL3_DEV) $(LIBNL_CLI_DEV)
$(ICCPD)_RDEPENDS += $(LIBNL_GENL3) $(LIBNL_CLI)
$(ICCPD)_SRC_PATH = $(SRC_PATH)/iccpd
SONIC_MAKE_DEBS += $(ICCPD)
SONIC_DPKG_DEBS += $(ICCPD)

# Export these variables so they can be used in a sub-make
export ICCPD_VERSION
export ICCPD
ICCPD_DBG = iccpd-dbg_$(ICCPD_VERSION)_$(CONFIGURED_ARCH).deb
$(ICCPD_DBG)_DEPENDS += $(ICCPD)
$(ICCPD_DBG)_RDEPENDS += $(ICCPD)
$(eval $(call add_derived_package,$(ICCPD),$(ICCPD_DBG)))

# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list}
# are archived into debug one image to facilitate debugging.
#
DBG_SRC_ARCHIVE += iccpd
37 changes: 0 additions & 37 deletions src/iccpd/Makefile

This file was deleted.

1 change: 1 addition & 0 deletions src/iccpd/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = src
6 changes: 6 additions & 0 deletions src/iccpd/autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

libtoolize --force --copy &&
autoreconf --force --install -I m4
rm -Rf autom4te.cache

32 changes: 32 additions & 0 deletions src/iccpd/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
AC_INIT([iccpd],[0.5])
AC_CONFIG_SRCDIR([])
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])
AC_LANG_C
AC_PROG_CC
AC_PROG_LIBTOOL
AC_HEADER_STDC

AC_ARG_ENABLE(debug,
[ --enable-debug Compile with debugging flags],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)

CPPFLAGS="-D_FORTIFY_SOURCE=2"

CFLAGS_COMMON="-Wno-unused-result"

AC_SUBST(CFLAGS_COMMON)

AC_CONFIG_FILES([
Makefile
src/Makefile
src/mclagdctl/Makefile
])

AC_OUTPUT
12 changes: 0 additions & 12 deletions src/iccpd/debian/DEBIAN/control

This file was deleted.

6 changes: 6 additions & 0 deletions src/iccpd/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sonic (0.0.5) stable; urgency=medium

* Initial release.

-- Tyler Li <tyler.li@mediatek.com> Thu, 23 Apr 2020 10:00:00 +0800

1 change: 1 addition & 0 deletions src/iccpd/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
18 changes: 18 additions & 0 deletions src/iccpd/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Source: sonic
Maintainer: Tyler Li <tyler.li@mediatek.com>
Section: net
Priority: optional
Build-Depends: dh-exec (>=0.3), debhelper (>= 9), autotools-dev
Standards-Version: 0.0.5

Package: iccpd
Architecture: any
Depends: ${shlibs:Depends}
Description: This package contains Inter-Chassis Control Protocol for SONiC project.

Package: iccpd-dbg
Architecture: any
Section: debug
Priority: extra
Depends: iccpd (=${binary:Version})
Description: debugging symbols for iccpd
34 changes: 34 additions & 0 deletions src/iccpd/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


# main packaging script based on dh7 syntax
%:
dh $@ --with autotools-dev

# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_auto_install:
dh_auto_install --destdir=debian/iccpd

override_dh_strip:
dh_strip --dbg-package=iccpd-dbg
1 change: 1 addition & 0 deletions src/iccpd/include/iccp_csm.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <sys/queue.h>
#include <unistd.h>
#include <time.h>
#include <pthread.h>

#include "../include/app_csm.h"
#include "../include/msg_format.h"
Expand Down
1 change: 1 addition & 0 deletions src/iccpd/include/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <unistd.h>

struct CSM;
struct System;

#define CONNECT_INTERVAL_SEC 1
#define CONNECT_TIMEOUT_MSEC 100
Expand Down
55 changes: 0 additions & 55 deletions src/iccpd/src/Makefile

This file was deleted.

22 changes: 22 additions & 0 deletions src/iccpd/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
SUBDIRS = mclagdctl

INCLUDES = -I$(top_srcdir)/include -I/usr/include/libnl3

bin_PROGRAMS = iccpd

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g -DNDEBUG
endif

iccpd_SOURCES = \
app_csm.c cmd_option.c iccp_cli.c iccp_cmd_show.c iccp_cmd.c \
iccp_csm.c iccp_ifm.c iccp_main.c logger.c \
port.c scheduler.c system.c iccp_consistency_check.c \
mlacp_link_handler.c \
mlacp_sync_prepare.c mlacp_sync_update.c\
mlacp_fsm.c \
iccp_netlink.c
iccpd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)
iccpd_LDADD = -lnl-genl-3 -lnl-route-3 -lnl-3 -lpthread
2 changes: 1 addition & 1 deletion src/iccpd/src/iccp_ifm.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void do_arp_update_from_reply_packet(unsigned int ifindex, unsigned int addr, ui
if (!verify_arp)
return;

if (iccp_check_if_addr_from_netlink(AF_INET, &addr, arp_lif))
if (iccp_check_if_addr_from_netlink(AF_INET, (uint8_t *)&addr, arp_lif))
{
ICCPD_LOG_DEBUG(__FUNCTION__, "ARP %s is identical with the ip address of interface %s",
show_ip_str(arp_msg->ipv4_addr), arp_lif->name);
Expand Down
28 changes: 0 additions & 28 deletions src/iccpd/src/mclagdctl/Makefile

This file was deleted.

10 changes: 10 additions & 0 deletions src/iccpd/src/mclagdctl/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bin_PROGRAMS = mclagdctl

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g -DNDEBUG
endif

mclagdctl_SOURCES = mclagdctl.c
mclagdctl_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)
4 changes: 3 additions & 1 deletion src/iccpd/src/mclagdctl/mclagdctl.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
/* Copyright(c) 2016-2019 Nephos.
* Copyright(c) 2016-2019 Nephos.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
Expand All @@ -21,6 +21,8 @@

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
#include <getopt.h>
Expand Down
2 changes: 1 addition & 1 deletion src/iccpd/src/mlacp_sync_prepare.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ int mlacp_prepare_for_arp_info(struct CSM* csm, char* buf, size_t max_buf_size,
tlv->icc_parameter.type = htons(TLV_T_MLACP_ARP_INFO);
}

ArpData = (struct mLACPMACData *)&buf[sizeof(ICCHdr) + sizeof(struct mLACPARPInfoTLV) + sizeof(struct ARPMsg) * count];
ArpData = (struct ARPMsg *)&buf[sizeof(ICCHdr) + sizeof(struct mLACPARPInfoTLV) + sizeof(struct ARPMsg) * count];

ArpData->op_type = arp_msg->op_type;
sprintf(ArpData->ifname, "%s", arp_msg->ifname);
Expand Down
2 changes: 2 additions & 0 deletions src/iccpd/src/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "../include/port.h"
#include "../include/system.h"
#include "../include/iccp_csm.h"
#include "../include/iccp_netlink.h"
#include "../include/scheduler.h"

void local_if_init(struct LocalInterface* local_if)
{
Expand Down
5 changes: 4 additions & 1 deletion src/iccpd/src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,10 @@ int scheduler_unregister_sock_read_event_callback(struct CSM* csm)
return MCLAG_ERROR;
}

FD_CLR(csm->sock_fd, &(sys->readfd));
if (csm->sock_fd > 0)
{
FD_CLR(csm->sock_fd, &(sys->readfd));
}

return 0;
}
Expand Down