|
version 1.1, 2012/02/21 17:26:12
|
version 1.1.1.3, 2013/07/21 23:54:39
|
|
Line 699 vty_end_config (struct vty *vty)
|
Line 699 vty_end_config (struct vty *vty)
|
| case ZEBRA_NODE: |
case ZEBRA_NODE: |
| case RIP_NODE: |
case RIP_NODE: |
| case RIPNG_NODE: |
case RIPNG_NODE: |
| |
case BABEL_NODE: |
| case BGP_NODE: |
case BGP_NODE: |
| case BGP_VPNV4_NODE: |
case BGP_VPNV4_NODE: |
| case BGP_IPV4_NODE: |
case BGP_IPV4_NODE: |
|
Line 1107 vty_stop_input (struct vty *vty)
|
Line 1108 vty_stop_input (struct vty *vty)
|
| case ZEBRA_NODE: |
case ZEBRA_NODE: |
| case RIP_NODE: |
case RIP_NODE: |
| case RIPNG_NODE: |
case RIPNG_NODE: |
| |
case BABEL_NODE: |
| case BGP_NODE: |
case BGP_NODE: |
| case RMAP_NODE: |
case RMAP_NODE: |
| case OSPF_NODE: |
case OSPF_NODE: |
|
Line 1610 vty_flush (struct thread *thread)
|
Line 1612 vty_flush (struct thread *thread)
|
| static struct vty * |
static struct vty * |
| vty_create (int vty_sock, union sockunion *su) |
vty_create (int vty_sock, union sockunion *su) |
| { |
{ |
| |
char buf[SU_ADDRSTRLEN]; |
| struct vty *vty; |
struct vty *vty; |
| |
|
| |
sockunion2str(su, buf, SU_ADDRSTRLEN); |
| |
|
| /* Allocate new vty structure and set up default values. */ |
/* Allocate new vty structure and set up default values. */ |
| vty = vty_new (); |
vty = vty_new (); |
| vty->fd = vty_sock; |
vty->fd = vty_sock; |
| vty->type = VTY_TERM; |
vty->type = VTY_TERM; |
| vty->address = sockunion_su2str (su); | strcpy (vty->address, buf); |
| if (no_password_check) |
if (no_password_check) |
| { |
{ |
| if (restricted_mode) |
if (restricted_mode) |
|
Line 1685 static int
|
Line 1690 static int
|
| vty_accept (struct thread *thread) |
vty_accept (struct thread *thread) |
| { |
{ |
| int vty_sock; |
int vty_sock; |
| struct vty *vty; |
|
| union sockunion su; |
union sockunion su; |
| int ret; |
int ret; |
| unsigned int on; |
unsigned int on; |
| int accept_sock; |
int accept_sock; |
| struct prefix *p = NULL; |
struct prefix *p = NULL; |
| struct access_list *acl = NULL; |
struct access_list *acl = NULL; |
| char *bufp; | char buf[SU_ADDRSTRLEN]; |
| |
|
| accept_sock = THREAD_FD (thread); |
accept_sock = THREAD_FD (thread); |
| |
|
|
Line 1718 vty_accept (struct thread *thread)
|
Line 1722 vty_accept (struct thread *thread)
|
| if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && |
if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && |
| (access_list_apply (acl, p) == FILTER_DENY)) |
(access_list_apply (acl, p) == FILTER_DENY)) |
| { |
{ |
| char *buf; |
|
| zlog (NULL, LOG_INFO, "Vty connection refused from %s", |
zlog (NULL, LOG_INFO, "Vty connection refused from %s", |
| (buf = sockunion_su2str (&su))); | sockunion2str (&su, buf, SU_ADDRSTRLEN)); |
| free (buf); | |
| close (vty_sock); |
close (vty_sock); |
| |
|
| /* continue accepting connections */ |
/* continue accepting connections */ |
|
Line 1740 vty_accept (struct thread *thread)
|
Line 1742 vty_accept (struct thread *thread)
|
| if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) && |
if ((acl = access_list_lookup (AFI_IP6, vty_ipv6_accesslist_name)) && |
| (access_list_apply (acl, p) == FILTER_DENY)) |
(access_list_apply (acl, p) == FILTER_DENY)) |
| { |
{ |
| char *buf; |
|
| zlog (NULL, LOG_INFO, "Vty connection refused from %s", |
zlog (NULL, LOG_INFO, "Vty connection refused from %s", |
| (buf = sockunion_su2str (&su))); | sockunion2str (&su, buf, SU_ADDRSTRLEN)); |
| free (buf); | |
| close (vty_sock); |
close (vty_sock); |
| |
|
| /* continue accepting connections */ |
/* continue accepting connections */ |
|
Line 1766 vty_accept (struct thread *thread)
|
Line 1766 vty_accept (struct thread *thread)
|
| safe_strerror (errno)); |
safe_strerror (errno)); |
| |
|
| zlog (NULL, LOG_INFO, "Vty connection from %s", |
zlog (NULL, LOG_INFO, "Vty connection from %s", |
| (bufp = sockunion_su2str (&su))); | sockunion2str (&su, buf, SU_ADDRSTRLEN)); |
| if (bufp) | |
| XFREE (MTYPE_TMP, bufp); | |
| |
|
| vty = vty_create (vty_sock, &su); | vty_create (vty_sock, &su); |
| |
|
| return 0; |
return 0; |
| } |
} |
|
Line 1816 vty_serv_sock_addrinfo (const char *hostname, unsigned
|
Line 1814 vty_serv_sock_addrinfo (const char *hostname, unsigned
|
| if (sock < 0) |
if (sock < 0) |
| continue; |
continue; |
| |
|
| |
sockopt_v6only (ainfo->ai_family, sock); |
| sockopt_reuseaddr (sock); |
sockopt_reuseaddr (sock); |
| sockopt_reuseport (sock); |
sockopt_reuseport (sock); |
| |
|
|
Line 1839 vty_serv_sock_addrinfo (const char *hostname, unsigned
|
Line 1838 vty_serv_sock_addrinfo (const char *hostname, unsigned
|
| |
|
| freeaddrinfo (ainfo_save); |
freeaddrinfo (ainfo_save); |
| } |
} |
| #endif /* HAVE_IPV6 && ! NRL */ | #else /* HAVE_IPV6 && ! NRL */ |
| |
|
| /* Make vty server socket. */ |
/* Make vty server socket. */ |
| static void |
static void |
|
Line 1905 vty_serv_sock_family (const char* addr, unsigned short
|
Line 1904 vty_serv_sock_family (const char* addr, unsigned short
|
| /* Add vty server event. */ |
/* Add vty server event. */ |
| vty_event (VTY_SERV, accept_sock, NULL); |
vty_event (VTY_SERV, accept_sock, NULL); |
| } |
} |
| |
#endif /* HAVE_IPV6 && ! NRL */ |
| |
|
| #ifdef VTYSH |
#ifdef VTYSH |
| /* For sockaddr_un. */ |
/* For sockaddr_un. */ |
|
Line 2190 vty_close (struct vty *vty)
|
Line 2190 vty_close (struct vty *vty)
|
| if (vty->fd > 0) |
if (vty->fd > 0) |
| close (vty->fd); |
close (vty->fd); |
| |
|
| if (vty->address) |
|
| XFREE (MTYPE_TMP, vty->address); |
|
| if (vty->buf) |
if (vty->buf) |
| XFREE (MTYPE_VTY, vty->buf); |
XFREE (MTYPE_VTY, vty->buf); |
| |
|