fix printing of netranges in the i and r displays for netatalk
This commit is contained in:
parent
43d1f899b2
commit
a8d3784533
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17966
@ -120,6 +120,24 @@ static char mybuf[50];
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
static char *
|
||||
at_pr_range(struct sockaddr_at *sat)
|
||||
{
|
||||
static char mybuf[50];
|
||||
|
||||
if(sat->sat_range.r_netrange.nr_firstnet
|
||||
!= sat->sat_range.r_netrange.nr_lastnet) {
|
||||
sprintf(mybuf,"%d-%d",
|
||||
ntohs(sat->sat_range.r_netrange.nr_firstnet),
|
||||
ntohs(sat->sat_range.r_netrange.nr_lastnet));
|
||||
} else {
|
||||
sprintf(mybuf,"%d",
|
||||
ntohs(sat->sat_range.r_netrange.nr_firstnet));
|
||||
}
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
|
||||
/* what == 0 for addr only == 3 */
|
||||
/* 1 for net */
|
||||
/* 2 for host */
|
||||
@ -134,7 +152,7 @@ atalk_print(sa,what)
|
||||
int numeric = (what & 0x08);
|
||||
|
||||
mybuf[0] = 0;
|
||||
switch (what & 3) {
|
||||
switch (what & 0x13) {
|
||||
case 0:
|
||||
mybuf[0] = 0;
|
||||
break;
|
||||
@ -148,9 +166,12 @@ atalk_print(sa,what)
|
||||
sprintf(mybuf,"%s.%s",
|
||||
at_pr_net(sat, numeric),
|
||||
at_pr_host(sat, numeric));
|
||||
break;
|
||||
case 0x10:
|
||||
sprintf(mybuf,"%s", at_pr_range(sat));
|
||||
}
|
||||
if (what & 4) {
|
||||
sprintf(mybuf+strlen(mybuf),"%s",at_pr_port(sat));
|
||||
sprintf(mybuf+strlen(mybuf),".%s",at_pr_port(sat));
|
||||
}
|
||||
return mybuf;
|
||||
}
|
||||
@ -160,9 +181,23 @@ atalk_print2(struct sockaddr *sa, struct sockaddr *mask, int what)
|
||||
{
|
||||
int n;
|
||||
static char buf[100];
|
||||
struct sockaddr_at *sat1, *sat2;
|
||||
struct sockaddr_at thesockaddr;
|
||||
struct sockaddr *sa2;
|
||||
|
||||
n = snprintf(buf, sizeof(buf), "%s", atalk_print(sa, what));
|
||||
snprintf(buf + n, sizeof(buf) - n, "/%s", atalk_print(mask, what));
|
||||
sat1 = (struct sockaddr_at *)sa;
|
||||
sat2 = (struct sockaddr_at *)mask;
|
||||
sa2 = (struct sockaddr *)&thesockaddr;
|
||||
|
||||
thesockaddr.sat_addr.s_net = sat1->sat_addr.s_net & sat2->sat_addr.s_net;
|
||||
n = snprintf(buf, sizeof(buf), "%s", atalk_print(sa2, 1 |(what & 8)));
|
||||
if(sat2->sat_addr.s_net != 0xFFFF) {
|
||||
thesockaddr.sat_addr.s_net = sat1->sat_addr.s_net | ~sat2->sat_addr.s_net;
|
||||
n += snprintf(buf + n, sizeof(buf) - n,
|
||||
"-%s", atalk_print(sa2, 1 |(what & 8)));
|
||||
}
|
||||
if(what & 2)
|
||||
n += snprintf(buf + n, sizeof(buf) - n, ".%s", atalk_print(sa, what&(~1)));
|
||||
return(buf);
|
||||
}
|
||||
|
||||
|
@ -188,8 +188,8 @@ intpr(interval, ifnetaddr)
|
||||
break;
|
||||
|
||||
case AF_APPLETALK:
|
||||
printf("atalk:%-7.7s ",atalk_print(sa,9) );
|
||||
printf("%-15.15s ",atalk_print(sa,11) );
|
||||
printf("atalk:%-12.12s ",atalk_print(sa,0x10) );
|
||||
printf("%-9.9s ",atalk_print(sa,0x0b) );
|
||||
break;
|
||||
#ifdef NS
|
||||
case AF_NS:
|
||||
|
Loading…
Reference in New Issue
Block a user