FreeBSD Bugzilla – Attachment 125457 Details for
Bug 169072
[patch] A little change to ifconfig(8) to display CIDR prefixes instead of hex masks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.txt
file.txt (text/plain), 2.02 KB, created by
Vitaliy Turovets
on 2012-06-14 16:50:01 UTC
(
hide
)
Description:
file.txt
Filename:
MIME Type:
Creator:
Vitaliy Turovets
Created:
2012-06-14 16:50:01 UTC
Size:
2.02 KB
patch
obsolete
>diff ifconfig/af_inet.c ifconfig_with_cidr_mode/af_inet.c >58a59,66 >> int hex2cidr(int i); >> int hex2cidr(int i) >> { >> i = i - ((i >> 1) & 0x55555555); >> i = (i & 0x33333333) + ((i >> 2) & 0x33333333); >> return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24; >> } >> >70c78 >< printf("\tinet %s ", inet_ntoa(sin->sin_addr)); >--- >> printf("\tinet %s", inet_ntoa(sin->sin_addr)); >76c84 >< printf("--> %s ", inet_ntoa(sin->sin_addr)); >--- >> printf(" --> %s ", inet_ntoa(sin->sin_addr)); >79a88 >> if((ifa->ifa_flags & IFF_POINTOPOINT) ||(!cidr)){ >82,89c91,102 >< printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr)); >< >< if (ifa->ifa_flags & IFF_BROADCAST) { >< sin = (struct sockaddr_in *)ifa->ifa_broadaddr; >< if (sin != NULL && sin->sin_addr.s_addr != 0) >< printf("broadcast %s", inet_ntoa(sin->sin_addr)); >< } >< putchar('\n'); >--- >> printf(" netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr)); >> if (ifa->ifa_flags & IFF_BROADCAST) { >> sin = (struct sockaddr_in *)ifa->ifa_broadaddr; >> if (sin != NULL && sin->sin_addr.s_addr != 0) >> printf("broadcast %s", inet_ntoa(sin->sin_addr)); >> }; >> putchar('\n'); >> }else{ //XXX:Here we go to print CIDR mask instead of hex mask >> if (sin == NULL) >> sin = &null_sin; >> printf("/%d\n", (hex2cidr((int)ntohl(sin->sin_addr.s_addr)))); >> }; >diff ifconfig/ifconfig.c ifconfig_with_cidr_mode/ifconfig.c >94c94 >< >--- >> int cidr=0; >137c137,138 >< " ifconfig %s[-d] [-m] [-u] [-v]\n", >--- >> " ifconfig %s[-d] [-m] [-u] [-v]\n" >> " ifconfig [-D]\n", >157a159 >> >159c161 >< strlcpy(options, "adklmnuv", sizeof(options)); >--- >> strlcpy(options, "aDdklmnuv", sizeof(options)); >163a166,168 >> case 'D': /* output IPv4 prefixes in CIDR format */ >> cidr++; >> break; >diff ifconfig/ifconfig.h ifconfig_with_cidr_mode/ifconfig.h >44a45,46 >> >> >134a137 >> extern int cidr;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 169072
: 125457