summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes2015-02-03 13:56:35 -0600
committerElliott Hughes2015-02-03 13:56:35 -0600
commitc463025a19aff3f9f92cffa3de6462316e8407a7 (patch)
treebd4294af322a646c4f30eb8528095dffa2d014d7 /libnetutils
parentf8e83054cb8a8b13ee84a4aeeaa0a2fd8debca81 (diff)
downloadplatform-system-core-c463025a19aff3f9f92cffa3de6462316e8407a7.tar.gz
platform-system-core-c463025a19aff3f9f92cffa3de6462316e8407a7.tar.xz
platform-system-core-c463025a19aff3f9f92cffa3de6462316e8407a7.zip
Revert "Remove netcfg's unused options."
This reverts commit f8e83054cb8a8b13ee84a4aeeaa0a2fd8debca81. Change-Id: Iede772f96ff9008277df433dcbb5f6603de65283
Diffstat (limited to 'libnetutils')
-rw-r--r--libnetutils/dhcpclient.c14
-rw-r--r--libnetutils/ifc_utils.c20
2 files changed, 27 insertions, 7 deletions
diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c
index a05b7cb0d..700b02f9b 100644
--- a/libnetutils/dhcpclient.c
+++ b/libnetutils/dhcpclient.c
@@ -353,28 +353,28 @@ static int send_message(int sock, int if_index, dhcp_msg *msg, int size)
353static int is_valid_reply(dhcp_msg *msg, dhcp_msg *reply, int sz) 353static int is_valid_reply(dhcp_msg *msg, dhcp_msg *reply, int sz)
354{ 354{
355 if (sz < DHCP_MSG_FIXED_SIZE) { 355 if (sz < DHCP_MSG_FIXED_SIZE) {
356 if (verbose) ALOGD("Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE); 356 if (verbose) ALOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE);
357 return 0; 357 return 0;
358 } 358 }
359 if (reply->op != OP_BOOTREPLY) { 359 if (reply->op != OP_BOOTREPLY) {
360 if (verbose) ALOGD("Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY); 360 if (verbose) ALOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY);
361 return 0; 361 return 0;
362 } 362 }
363 if (reply->xid != msg->xid) { 363 if (reply->xid != msg->xid) {
364 if (verbose) ALOGD("Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid), 364 if (verbose) ALOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid),
365 ntohl(msg->xid)); 365 ntohl(msg->xid));
366 return 0; 366 return 0;
367 } 367 }
368 if (reply->htype != msg->htype) { 368 if (reply->htype != msg->htype) {
369 if (verbose) ALOGD("Wrong Htype %d != %d\n", reply->htype, msg->htype); 369 if (verbose) ALOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype);
370 return 0; 370 return 0;
371 } 371 }
372 if (reply->hlen != msg->hlen) { 372 if (reply->hlen != msg->hlen) {
373 if (verbose) ALOGD("Wrong Hlen %d != %d\n", reply->hlen, msg->hlen); 373 if (verbose) ALOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen);
374 return 0; 374 return 0;
375 } 375 }
376 if (memcmp(msg->chaddr, reply->chaddr, msg->hlen)) { 376 if (memcmp(msg->chaddr, reply->chaddr, msg->hlen)) {
377 if (verbose) ALOGD("Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr)); 377 if (verbose) ALOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr));
378 return 0; 378 return 0;
379 } 379 }
380 return 1; 380 return 1;
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index ab6c6540a..bfe712193 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -639,6 +639,26 @@ int ifc_reset_connections(const char *ifname, const int reset_mask)
639#endif 639#endif
640} 640}
641 641
642/*
643 * Removes the default route for the named interface.
644 */
645int ifc_remove_default_route(const char *ifname)
646{
647 struct rtentry rt;
648 int result;
649
650 ifc_init();
651 memset(&rt, 0, sizeof(rt));
652 rt.rt_dev = (void *)ifname;
653 rt.rt_flags = RTF_UP|RTF_GATEWAY;
654 init_sockaddr_in(&rt.rt_dst, 0);
655 if ((result = ioctl(ifc_ctl_sock, SIOCDELRT, &rt)) < 0) {
656 ALOGD("failed to remove default route for %s: %s", ifname, strerror(errno));
657 }
658 ifc_close();
659 return result;
660}
661
642int 662int
643ifc_configure(const char *ifname, 663ifc_configure(const char *ifname,
644 in_addr_t address, 664 in_addr_t address,