FreeBSD Bugzilla – Attachment 242216 Details for
Bug 261572
ifconfig(8): extend formatting of MAC addresses to dotted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for ifconfig(8) adding the dotted format for MAC addresses
ifconfig-dotted-ether-format.diff (text/plain), 1.63 KB, created by
Trond Endrestøl
on 2023-05-16 16:46:54 UTC
(
hide
)
Description:
Patch for ifconfig(8) adding the dotted format for MAC addresses
Filename:
MIME Type:
Creator:
Trond Endrestøl
Created:
2023-05-16 16:46:54 UTC
Size:
1.63 KB
patch
obsolete
>diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c >index f651ddc51cb4..289186443a3b 100644 >--- a/sbin/ifconfig/af_link.c >+++ b/sbin/ifconfig/af_link.c >@@ -61,11 +61,28 @@ print_ether(const struct ether_addr *addr, const char *prefix) > { > char *ether_format = ether_ntoa(addr); > >- if (f_ether != NULL && strcmp(f_ether, "dash") == 0) { >- char *format_char; >- >- while ((format_char = strchr(ether_format, ':')) != NULL) { >- *format_char = '-'; >+ if (f_ether != NULL) { >+ if (strcmp(f_ether, "dash") == 0) { >+ char *format_char; >+ >+ while ((format_char = strchr(ether_format, ':')) != NULL) { >+ *format_char = '-'; >+ } >+ } else if (strcmp(f_ether, "dotted") == 0) { >+ /* Indices 0 and 1 is kept as is. */ >+ ether_format[ 2] = ether_format[ 3]; >+ ether_format[ 3] = ether_format[ 4]; >+ ether_format[ 4] = '.'; >+ ether_format[ 5] = ether_format[ 6]; >+ ether_format[ 6] = ether_format[ 7]; >+ ether_format[ 7] = ether_format[ 9]; >+ ether_format[ 8] = ether_format[10]; >+ ether_format[ 9] = '.'; >+ ether_format[10] = ether_format[12]; >+ ether_format[11] = ether_format[13]; >+ ether_format[12] = ether_format[15]; >+ ether_format[13] = ether_format[16]; >+ ether_format[14] = '\0'; > } > } > printf("\t%s %s\n", prefix, ether_format); >diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 >index 4669e96e28e6..5e1aa1631de0 100644 >--- a/sbin/ifconfig/ifconfig.8 >+++ b/sbin/ifconfig/ifconfig.8 >@@ -153,6 +153,8 @@ Separate address segments with a dash > .It Cm default > Default format, > .Cm colon >+.It Cm dotted >+Separate address segments with a dot > .El > .It Cm inet > Adjust the display of inet address subnet masks:
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261572
:
231443
| 242216