@@ -62,7 +62,7 @@ IfaceMgr::instancePtr() {
62
62
}
63
63
64
64
Iface::Iface (const std::string& name, unsigned int ifindex)
65
- : name_(name), ifindex_(ifindex), mac_len_(0 ), hardware_type_(0 ),
65
+ : name_(name), ifindex_(ifindex), mac_len_(0 ), bcast_mac_len_( 0 ), hardware_type_(0 ),
66
66
flag_loopback_ (false ), flag_up_(false ), flag_running_(false ),
67
67
flag_multicast_(false ), flag_broadcast_(false ), flags_(0 ),
68
68
inactive4_(false ), inactive6_(false ) {
@@ -142,6 +142,21 @@ Iface::getPlainMac() const {
142
142
return (tmp.str ());
143
143
}
144
144
145
+ std::string
146
+ Iface::getPlainBcastMac () const {
147
+ ostringstream tmp;
148
+ tmp.fill (' 0' );
149
+ tmp << hex;
150
+ for (int i = 0 ; i < bcast_mac_len_; i++) {
151
+ tmp.width (2 );
152
+ tmp << static_cast <int >(bcast_mac_[i]);
153
+ if (i < bcast_mac_len_-1 ) {
154
+ tmp << " :" ;
155
+ }
156
+ }
157
+ return (tmp.str ());
158
+ }
159
+
145
160
void Iface::setMac (const uint8_t * mac, size_t len) {
146
161
if (len > MAX_MAC_LEN) {
147
162
isc_throw (OutOfRange, " Interface " << getFullName ()
@@ -155,6 +170,19 @@ void Iface::setMac(const uint8_t* mac, size_t len) {
155
170
}
156
171
}
157
172
173
+ void Iface::setBcastMac (const uint8_t * mac, size_t len) {
174
+ if (len > MAX_MAC_LEN) {
175
+ isc_throw (OutOfRange, " Interface " << getFullName ()
176
+ << " was detected to have link address of length "
177
+ << len << " , but maximum supported length is "
178
+ << MAX_MAC_LEN);
179
+ }
180
+ bcast_mac_len_ = len;
181
+ if (len > 0 ) {
182
+ memcpy (bcast_mac_, mac, len);
183
+ }
184
+ }
185
+
158
186
bool Iface::delAddress (const isc::asiolink::IOAddress& addr) {
159
187
for (AddressCollection::iterator a = addrs_.begin (); a != addrs_.end (); ++a) {
160
188
if (a->get () == addr) {
@@ -791,7 +819,8 @@ IfaceMgr::printIfaces(std::ostream& out /*= std::cout*/) {
791
819
792
820
out << " Detected interface " << iface->getFullName ()
793
821
<< " , hwtype=" << iface->getHWType ()
794
- << " , mac=" << iface->getPlainMac ();
822
+ << " , mac=" << iface->getPlainMac ()
823
+ << " , bcast=" << iface->getPlainBcastMac ();
795
824
out << " , flags=" << hex << iface->flags_ << dec << " ("
796
825
<< (iface->flag_loopback_ ?" LOOPBACK " :" " )
797
826
<< (iface->flag_up_ ?" UP " :" " )
0 commit comments