According to the manual the option "--numeric-ports" should not affect host resolution, but it does. All connected hosts are displayed with numeric values instead of their FQDN. Reproducible: Always Steps to Reproduce: 1. netstat --numeric-ports 2. 3. Actual Results: It did not display FQDN for the hosts Expected Results: Displayed FQDN for the hosts Here's a patch I made that fixes this--why can't I add attachments to this bugzilla? --- net-tools-1.60/netstat.c +++ net-tools-1.60/netstat.c @@ -850,8 +850,8 @@ txq = 0L; } safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, - flag_not), sizeof(local_addr)); - safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not), + flag_not & FLAG_NUM_HOST), sizeof(local_addr)); + safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); if (flag_all || (flag_lst && !rem_port) || (!flag_lst && rem_port)) { snprintf(buffer, sizeof(buffer), "%s", @@ -1004,7 +1004,7 @@ if (flag_all || (notnull(remaddr) && !flag_lst) || (!notnull(remaddr) && flag_lst)) { safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, - flag_not), sizeof(local_addr)); + flag_not & FLAG_NUM_HOST), sizeof(local_addr)); snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(local_port), "udp", flag_not & FLAG_NUM_PORT)); @@ -1016,7 +1016,7 @@ snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(rem_port), "udp", flag_not & FLAG_NUM_PORT)); safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, - flag_not), sizeof(rem_addr)); + flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); if ((strlen(rem_addr) + strlen(buffer)) > 22) rem_addr[22 - strlen(buffer)] = '\0'; strcat(rem_addr, ":"); @@ -1126,7 +1126,7 @@ get_sname(htons(local_port), "raw", flag_not & FLAG_NUM_PORT)); safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, - flag_not), sizeof(local_addr)); + flag_not & FLAG_NUM_HOST), sizeof(local_addr)); if ((strlen(local_addr) + strlen(buffer)) > 22) local_addr[22 - strlen(buffer)] = '\0'; strcat(local_addr, ":"); @@ -1135,7 +1135,7 @@ snprintf(buffer, sizeof(buffer), "%s", get_sname(htons(rem_port), "raw", flag_not & FLAG_NUM_PORT)); safe_strncpy(rem_addr, ap->sprint((struct sockaddr *) &remaddr, - flag_not), sizeof(rem_addr)); + flag_not & FLAG_NUM_HOST), sizeof(rem_addr)); if ((strlen(rem_addr) + strlen(buffer)) > 22) rem_addr[22 - strlen(buffer)] = '\0'; strcat(rem_addr, ":");
Created attachment 47695 [details, diff] Here's the patch attached. So, I could add attachments ;-)
I've sent it upstream already.
tested and reviewed. *stamp of approval*
added to net-tools-1.60-r10, thanks :)