diff options
Diffstat (limited to 'util/ipmilan.c')
-rw-r--r-- | util/ipmilan.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/util/ipmilan.c b/util/ipmilan.c index b852f3a..814092e 100644 --- a/util/ipmilan.c +++ b/util/ipmilan.c @@ -215,7 +215,7 @@ extern char * get_iana_str(int mfg); /*subs.c*/ #define dbg_dump dump_buf extern FILE *fperr; /*defined in ipmicmd.c, usu stderr */ extern FILE *fpdbg; /*defined in ipmicmd.c, usu stdout */ -extern int gshutdown; /* from ipmicmd.c */ +extern int gshutdown; /* from ipmicmd.c, usu =0 */ extern int fauth_type_set; /* from ipmicmd.c */ extern LAN_OPT lanp; /* from ipmicmd.c */ //extern char *gnode; /* from ipmicmd.c */ @@ -236,7 +236,7 @@ static int vend_id = 0; static int prod_id = 0; #if defined(DOS) || defined(EFI) -int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd) +int ipmi_open_lan(char *node, char *user, int port, char *pswd, int fdebugcmd) { printf("IPMI LAN is not supported under DOS.\n"); return(-1); @@ -520,9 +520,9 @@ void close_sockfd(SockType sfd) pconn->sockfd = 0; /*set global to zero */ } -int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, +int open_sockfd(char *node, int port, SockType *sfd, SOCKADDR_T *daddr, int *daddr_len, int foutput); -int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, +int open_sockfd(char *node, int port, SockType *sfd, SOCKADDR_T *daddr, int *daddr_len, int foutput) { int rv = 0; @@ -560,7 +560,7 @@ int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, #ifdef HAVE_IPV6 memset(&_srcaddr, 0, sizeof(_srcaddr)); memset(daddr, 0, sizeof(_destaddr)); - sprintf(service, "%d", RMCP_PRI_RMCP_PORT); + sprintf(service, "%d", port); /* Obtain address(es) matching host/port */ memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ @@ -623,7 +623,7 @@ int open_sockfd(char *node, SockType *sfd, SOCKADDR_T *daddr, memset(daddr, 0, sizeof(SOCKADDR_T)); daddr->sin_family = AF_INET; - daddr->sin_port = htons(RMCP_PRI_RMCP_PORT); /*0x26f = 623.*/ + daddr->sin_port = htons(port); /*RMCP_PRI_RMCP_PORT 0x26f = 623.*/ if (StrIsIp(node)) { /* the node string is an IP address */ uchar in_ip[4]; atoip(in_ip,node); @@ -1645,7 +1645,7 @@ int ping_bmc(char *node, int fdebugcmd) SockType sfd; int rv; - rv = open_sockfd(node,&sfd, &toaddr, &toaddr_len, fdebugcmd); + rv = open_sockfd(node, RMCP_PRI_RMCP_PORT, &sfd, &toaddr, &toaddr_len, fdebugcmd); if (rv != 0) return(rv); rv = rmcp_ping(sfd, (struct sockaddr *)&toaddr,toaddr_len, fdebugcmd); @@ -1676,7 +1676,7 @@ static int get_rand(void *data, int len) /* * ipmi_open_lan */ -int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd) +int ipmi_open_lan(char *node, int port, char *user, char *pswd, int fdebugcmd) { char *username; uchar priv_level; @@ -1697,21 +1697,21 @@ int ipmi_open_lan(char *node, char *user, char *pswd, int fdebugcmd) goto EXIT; } else { - if ((gshutdown==0) || fdebugcmd) + if (fdebugcmd) fprintf(fpdbg,"Opening lan connection to node %s ...\n",node); /* save nodename for sig_abort later */ if (strlen(node) > SZGNODE) { strncpy(nodename, node, SZGNODE); nodename[SZGNODE] = 0; } else strcpy(nodename, node); - - rv = open_sockfd(node, &(pconn->sockfd), &_destaddr, &_destaddr_len, 1); + rv = open_sockfd(node, port, &(pconn->sockfd), &_destaddr, &_destaddr_len, 1); if (fdebugcmd) printf("open_sockfd returned %d, fd=%d\n", rv, pconn->sockfd); if (rv != 0) goto EXIT; #ifdef HAVE_IPV6 strcpy(gnodename,nodename); - fprintf(fpdbg,"Connecting to node %s\n",gnodename); + if (fdebugcmd) + fprintf(fpdbg,"Connecting to node %s\n",gnodename); #else #ifdef WIN32 /* check for ws2_32.lib(getnameinfo) resolution */ @@ -1904,7 +1904,7 @@ int ipmicmd_lan(char *node, if (pconn->sockfd == 0) { /* closed, do re-open */ if (fdebugcmd) fprintf(fpdbg,"sockfd==0, node %s needs re-open\n",node); - rv = ipmi_open_lan(lanp.node, lanp.user, lanp.pswd, fdebugcmd); + rv = ipmi_open_lan(lanp.node, lanp.port, lanp.user, lanp.pswd, fdebugcmd); if (rv != 0) goto EXIT; } if (fdebugcmd) { |