Created
August 30, 2016 15:10
-
-
Save bluecmd/647e092d0c74801a79ba067ed955dcf3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [openswitch]$ git status [ops-build] | |
| On branch master | |
| Your branch is up-to-date with 'github/master'. | |
| Untracked files: | |
| (use "git add <file>..." to include in what will be committed) | |
| bisect | |
| nothing added to commit but untracked files present (use "git add" to track) | |
| [openswitch]$ git log -n1 [ops-build] | |
| commit a42c81be8d3d8959a6ff2931552ea6ec3254e514 | |
| Author: vijavaru <[email protected]> | |
| Date: Fri Aug 26 15:34:37 2016 -0700 | |
| chg, dev : SRCREV update of ops-cli , Master branch | |
| Change-Id: I3c729275d1a8680559451241dc71d3bfde532664 | |
| Signed-off-by: vijavaru <[email protected]> | |
| [openswitch]$ ls src [ops-build] | |
| ops-portd ops-supportability Rules.make | |
| [openswitch]$ cd src/ops-portd [ops-build] | |
| [openswitch]$ git status [ops-portd] | |
| On branch master | |
| Your branch and 'origin/master' have diverged, | |
| and have 20 and 22 different commits each, respectively. | |
| (use "git pull" to merge the remote branch into yours) | |
| nothing to commit, working directory clean | |
| [openswitch]$ git log origin/master -n1 [ops-portd] | |
| commit 6236195f1b49eac8dde7cf30778f253abde73b99 | |
| Author: Abhilash YG <[email protected]> | |
| Date: Wed Jul 27 02:00:01 2016 -0700 | |
| In show event, configuration of ipv6 address on a sub-interface should show "ipv6 address" rather than "ip address" | |
| Fixed to handle event being logged as IPv4 address even when IPv6 address is configured. | |
| Tags: fix,dev | |
| TG-1692 | |
| Change-Id: I2637b6d71b41c252d9952f640416abcd665d57f2 | |
| Signed-off-by: Abhilash YG <[email protected]> | |
| [openswitch]$ git diff origin/master [ops-portd] | |
| diff --git a/src/portd.c b/src/portd.c | |
| index b79f42e..baa467e 100644 | |
| --- a/src/portd.c | |
| +++ b/src/portd.c | |
| @@ -139,7 +139,7 @@ static inline void portd_chk_for_system_configured(void); | |
| static void portd_vlan_intf_config_on_init(int intf_index, | |
| struct rtattr *link_info); | |
| static void portd_update_kernel_intf_up_down (char *intf_name); | |
| -static void parse_nl_new_link_msg(struct nlmsghdr *h, struct shash *kernel_port_list); | |
| +static void parse_nl_new_link_msg(struct nlmsghdr *h); | |
| static void portd_netlink_socket_open(char* vrf_ns_name, int *sock, bool is_init_sock); | |
| static void portd_init(const char *remote); | |
| @@ -184,11 +184,8 @@ static void portd_del_ports(struct vrf *vrf, | |
| static void portd_add_del_ports(void); | |
| /* Init functions */ | |
| -static void portd_intf_config_on_init (struct shash *kernel_port_list); | |
| +static void portd_intf_config_on_init (void); | |
| static void portd_vlan_config_on_init(void); | |
| -static int portd_kernel_if_sync_check_on_init (void); | |
| -extern struct kernel_port* find_or_create_kernel_port( | |
| - struct shash *kernel_port_list, const char *ifname); | |
| /* VRF related functions */ | |
| static void portd_vrf_del(struct vrf *vrf); | |
| @@ -502,7 +499,7 @@ nl_msg_process(void *user_data, int sock, bool on_init) | |
| } | |
| break; | |
| case RTM_NEWLINK: | |
| - parse_nl_new_link_msg(nlh, user_data); | |
| + parse_nl_new_link_msg(nlh); | |
| break; | |
| case NLMSG_DONE: | |
| @@ -676,7 +673,7 @@ portd_update_kernel_intf_up_down(char *intf_name) | |
| * state from the DB and update the kernel accordingly. | |
| */ | |
| static void | |
| -parse_nl_new_link_msg(struct nlmsghdr *h, struct shash *kernel_port_list) | |
| +parse_nl_new_link_msg(struct nlmsghdr *h) | |
| { | |
| struct ifinfomsg *iface; | |
| struct rtattr *attribute; | |
| @@ -691,14 +688,6 @@ parse_nl_new_link_msg(struct nlmsghdr *h, struct shash *kernel_port_list) | |
| case IFLA_IFNAME: | |
| VLOG_DBG("New interface %d : %s\n", | |
| iface->ifi_index, (char *) RTA_DATA(attribute)); | |
| - | |
| - if (portd_config_on_init && kernel_port_list) { | |
| - struct kernel_port *port; | |
| - | |
| - port = find_or_create_kernel_port (kernel_port_list, (char *)RTA_DATA(attribute)); | |
| - shash_add_once(kernel_port_list, (char *)RTA_DATA(attribute), port); | |
| - } | |
| - | |
| portd_update_kernel_intf_up_down((char *)RTA_DATA(attribute)); | |
| break; | |
| case IFLA_LINKINFO: | |
| @@ -883,7 +872,6 @@ static void | |
| portd_exit(void) | |
| { | |
| close(nl_sock); | |
| - nl_sock = -1; | |
| ovsdb_idl_destroy(idl); | |
| } | |
| @@ -2667,7 +2655,7 @@ portd_add_del_ports(void) | |
| * state in sync with the OVSDB | |
| */ | |
| static void | |
| -portd_intf_config_on_init (struct shash *kernel_port_list) | |
| +portd_intf_config_on_init(void) | |
| { | |
| struct rtattr *rta; | |
| struct { | |
| @@ -2693,48 +2681,7 @@ portd_intf_config_on_init (struct shash *kernel_port_list) | |
| /* Process the response from kernel */ | |
| VLOG_DBG("Interfaces dump request sent on init"); | |
| - nl_msg_process(kernel_port_list, init_sock, true); | |
| -} | |
| - | |
| -/* This function checks if the kernel has all the interfaces already | |
| - * created in sync with the db. | |
| - * This is function is created on init. | |
| - * return : number of interfaces yet to be created in the kernel | |
| - */ | |
| -static int | |
| -portd_kernel_if_sync_check_on_init (void) | |
| -{ | |
| - struct shash kernel_port_list; | |
| - const struct ovsrec_interface *intf_row; | |
| - struct kernel_port *kernel_port; | |
| - struct shash_node *node, *next; | |
| - unsigned int wait_for_kernel_if_sync; | |
| - | |
| - shash_init (&kernel_port_list); | |
| - | |
| - portd_intf_config_on_init (&kernel_port_list); | |
| - | |
| - wait_for_kernel_if_sync = 0; | |
| - | |
| - OVSREC_INTERFACE_FOR_EACH (intf_row, idl) { | |
| - if (!(strncmp(intf_row->type, OVSREC_INTERFACE_TYPE_SYSTEM, | |
| - strlen(OVSREC_INTERFACE_TYPE_SYSTEM))) && | |
| - !shash_find_data(&kernel_port_list, intf_row->name)) { | |
| - wait_for_kernel_if_sync++; | |
| - } | |
| - } | |
| - | |
| - SHASH_FOR_EACH_SAFE (node, next, &kernel_port_list) { | |
| - kernel_port = node->data; | |
| - hmap_destroy(&kernel_port->ip4addr); | |
| - hmap_destroy(&kernel_port->ip6addr); | |
| - SAFE_FREE(kernel_port->name); | |
| - SAFE_FREE(kernel_port); | |
| - } | |
| - shash_destroy(&kernel_port_list); | |
| - | |
| - VLOG_DBG ("%u interfaces are yet be created in the kernel", wait_for_kernel_if_sync); | |
| - return wait_for_kernel_if_sync; | |
| + nl_msg_process(NULL, init_sock, true); | |
| } | |
| /** | |
| @@ -2905,14 +2852,9 @@ portd_reconfigure(void) | |
| if (portd_config_on_init) { | |
| /* Open an init sock to process reconfiguration */ | |
| portd_netlink_socket_open(DEFAULT_VRF_NAME, &init_sock, true); | |
| - if (portd_kernel_if_sync_check_on_init()) { | |
| - VLOG_DBG ("kernel if NOT in sync - returning!!"); | |
| - sleep (1); | |
| - return; | |
| - } | |
| portd_vlan_config_on_init(); | |
| - portd_intf_config_on_init(NULL); | |
| portd_ipaddr_config_on_init(); | |
| + portd_intf_config_on_init(); | |
| } | |
| update_interface_cache(); | |
| @@ -2931,10 +2873,8 @@ portd_reconfigure(void) | |
| if (portd_config_on_init) { | |
| portd_config_on_init = false; | |
| - VLOG_DBG ("restting portd_config_on_init to 0"); | |
| /* Close the init socket as it is not needed anymore */ | |
| close(init_sock); | |
| - init_sock = -1; | |
| } | |
| /* Determine the new 'forwarding state' for each port */ | |
| diff --git a/src/portd_l3.c b/src/portd_l3.c | |
| index 772b378..241d0e0 100644 | |
| --- a/src/portd_l3.c | |
| +++ b/src/portd_l3.c | |
| @@ -64,7 +64,7 @@ static void portd_del_ipv4_addr(struct port *port); | |
| static void portd_del_ipv6_addr(struct port *port); | |
| static int add_link_attr(struct nlmsghdr *n, int nlmsg_maxlen, | |
| int attr_type, const void *payload, int payload_len); | |
| -struct kernel_port* find_or_create_kernel_port( | |
| +static struct kernel_port* find_or_create_kernel_port( | |
| struct shash *kernel_port_list, const char *ifname); | |
| static bool portd_kernel_ip_addr_lookup(struct kernel_port *kernel_port, | |
| char *ip_address, bool ipv6); | |
| @@ -1152,7 +1152,7 @@ add_link_attr(struct nlmsghdr *n, int nlmsg_maxlen, | |
| * This function is used to check and add a kernel interface to the | |
| * kernel port list which will be used later to compare with DB list. | |
| */ | |
| -struct kernel_port * | |
| +static struct kernel_port * | |
| find_or_create_kernel_port(struct shash *kernel_port_list, const char *ifname) | |
| { | |
| struct kernel_port *port; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment