@@ -58,26 +58,26 @@ void NetlinkHandler::onEvent(NetlinkEvent *evt) {
58
58
}
59
59
60
60
if (!strcmp (subsys, " net" )) {
61
- int action = evt->getAction ();
61
+ NetlinkEvent::Action action = evt->getAction ();
62
62
const char *iface = evt->findParam (" INTERFACE" );
63
63
64
- if (action == evt-> NlActionAdd ) {
64
+ if (action == NetlinkEvent::Action:: kAdd ) {
65
65
notifyInterfaceAdded (iface);
66
- } else if (action == evt-> NlActionRemove ) {
66
+ } else if (action == NetlinkEvent::Action:: kRemove ) {
67
67
notifyInterfaceRemoved (iface);
68
- } else if (action == evt-> NlActionChange ) {
68
+ } else if (action == NetlinkEvent::Action:: kChange ) {
69
69
evt->dump ();
70
70
notifyInterfaceChanged (" nana" , true );
71
- } else if (action == evt-> NlActionLinkUp ) {
71
+ } else if (action == NetlinkEvent::Action:: kLinkUp ) {
72
72
notifyInterfaceLinkChanged (iface, true );
73
- } else if (action == evt-> NlActionLinkDown ) {
73
+ } else if (action == NetlinkEvent::Action:: kLinkDown ) {
74
74
notifyInterfaceLinkChanged (iface, false );
75
- } else if (action == evt-> NlActionAddressUpdated ||
76
- action == evt-> NlActionAddressRemoved ) {
75
+ } else if (action == NetlinkEvent::Action:: kAddressUpdated ||
76
+ action == NetlinkEvent::Action:: kAddressRemoved ) {
77
77
const char *address = evt->findParam (" ADDRESS" );
78
78
const char *flags = evt->findParam (" FLAGS" );
79
79
const char *scope = evt->findParam (" SCOPE" );
80
- if (action == evt-> NlActionAddressRemoved && iface && address) {
80
+ if (action == NetlinkEvent::Action:: kAddressRemoved && iface && address) {
81
81
int resetMask = strchr (address, ' :' ) ? RESET_IPV6_ADDRESSES : RESET_IPV4_ADDRESSES;
82
82
resetMask |= RESET_IGNORE_INTERFACE_ADDRESS;
83
83
if (int ret = ifc_reset_connections (iface, resetMask)) {
@@ -88,14 +88,14 @@ void NetlinkHandler::onEvent(NetlinkEvent *evt) {
88
88
if (iface && flags && scope) {
89
89
notifyAddressChanged (action, address, iface, flags, scope);
90
90
}
91
- } else if (action == evt-> NlActionRdnss ) {
91
+ } else if (action == NetlinkEvent::Action:: kRdnss ) {
92
92
const char *lifetime = evt->findParam (" LIFETIME" );
93
93
const char *servers = evt->findParam (" SERVERS" );
94
94
if (lifetime && servers) {
95
95
notifyInterfaceDnsServers (iface, lifetime, servers);
96
96
}
97
- } else if (action == evt-> NlActionRouteUpdated ||
98
- action == evt-> NlActionRouteRemoved ) {
97
+ } else if (action == NetlinkEvent::Action:: kRouteUpdated ||
98
+ action == NetlinkEvent::Action:: kRouteRemoved ) {
99
99
const char *route = evt->findParam (" ROUTE" );
100
100
const char *gateway = evt->findParam (" GATEWAY" );
101
101
const char *iface = evt->findParam (" INTERFACE" );
@@ -174,12 +174,12 @@ void NetlinkHandler::notifyInterfaceClassActivity(const char *name,
174
174
" IfaceClass %s %s %s" , isActive ? " active" : " idle" , name, timestamp);
175
175
}
176
176
177
- void NetlinkHandler::notifyAddressChanged (int action, const char *addr,
177
+ void NetlinkHandler::notifyAddressChanged (NetlinkEvent::Action action, const char *addr,
178
178
const char *iface, const char *flags,
179
179
const char *scope) {
180
180
notify (ResponseCode::InterfaceAddressChange,
181
181
" Address %s %s %s %s %s" ,
182
- (action == NetlinkEvent::NlActionAddressUpdated ) ? kUpdated : kRemoved ,
182
+ (action == NetlinkEvent::Action:: kAddressUpdated ) ? kUpdated : kRemoved ,
183
183
addr, iface, flags, scope);
184
184
}
185
185
@@ -190,11 +190,11 @@ void NetlinkHandler::notifyInterfaceDnsServers(const char *iface,
190
190
iface, lifetime, servers);
191
191
}
192
192
193
- void NetlinkHandler::notifyRouteChange (int action, const char *route,
193
+ void NetlinkHandler::notifyRouteChange (NetlinkEvent::Action action, const char *route,
194
194
const char *gateway, const char *iface) {
195
195
notify (ResponseCode::RouteChange,
196
196
" Route %s %s%s%s%s%s" ,
197
- (action == NetlinkEvent::NlActionRouteUpdated ) ? kUpdated : kRemoved ,
197
+ (action == NetlinkEvent::Action:: kRouteUpdated ) ? kUpdated : kRemoved ,
198
198
route,
199
199
*gateway ? " via " : " " ,
200
200
gateway,
0 commit comments