diff options
author | Ajay Nambi <anambi@codeaurora.org> | 2011-05-26 10:12:11 -0600 |
---|---|---|
committer | Ajay Nambi <anambi@codeaurora.org> | 2011-06-06 15:57:32 -0700 |
commit | adc1e694ff00cd96141db96a5b054913c668d6a1 (patch) | |
tree | c274bb059173748610370cedacc4d02574c7afa8 | |
parent | 1c7a9c9c8fccb2636593a752205f6d3e8d37ce01 (diff) | |
download | bionic-adc1e694ff00cd96141db96a5b054913c668d6a1.zip bionic-adc1e694ff00cd96141db96a5b054913c668d6a1.tar.gz bionic-adc1e694ff00cd96141db96a5b054913c668d6a1.tar.bz2 |
LibC definitions for missing elements needed for networking
* Implementations for getprotobyname and getprotobynumber.
* Add enable_flow flag for PRIO qdisc
Change-Id: Ic9facd002e54a19c97ed9ae5e51e97dcdccad1cf
-rw-r--r-- | libc/bionic/stubs.c | 37 | ||||
-rw-r--r-- | libc/kernel/common/linux/pkt_sched.h | 1 |
2 files changed, 35 insertions, 3 deletions
diff --git a/libc/bionic/stubs.c b/libc/bionic/stubs.c index d495674..e943e9e 100644 --- a/libc/bionic/stubs.c +++ b/libc/bionic/stubs.c @@ -341,7 +341,7 @@ getgrnam(const char *name) struct netent* getnetbyname(const char *name) { - fprintf(stderr, "FIX ME! implement getgrnam() %s:%d\n", __FILE__, __LINE__); + fprintf(stderr, "FIX ME! implement getnetbyname() %s:%d\n", __FILE__, __LINE__); return NULL; } @@ -373,15 +373,46 @@ struct netent *getnetbyaddr(uint32_t net, int type) return NULL; } +// Android doesn't have /etc/protocols. Use this minimal list. +struct protoent protocols[] = { + {"ip", {"IP", NULL}, 0}, + {"icmp", {"ICMP", NULL}, 1}, + {"tcp", {"TCP", NULL}, 6}, + {"udp", {"UDP", NULL}, 17}, + {NULL, {NULL}, 0} +}; + struct protoent *getprotobyname(const char *name) { - fprintf(stderr, "FIX ME! implement %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + int i = 0; + + while (name && protocols[i].p_name != 0) + { + if (strcmp(protocols[i].p_name, name) == 0) + { + return &protocols[i]; + } + + i++; + } + return NULL; } struct protoent *getprotobynumber(int proto) { - fprintf(stderr, "FIX ME! implement %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); + int i = 0; + + while (protocols[i].p_name != 0) + { + if (protocols[i].p_proto == proto) + { + return &protocols[i]; + } + + i++; + } + return NULL; } diff --git a/libc/kernel/common/linux/pkt_sched.h b/libc/kernel/common/linux/pkt_sched.h index 0b2966a..992a7a3 100644 --- a/libc/kernel/common/linux/pkt_sched.h +++ b/libc/kernel/common/linux/pkt_sched.h @@ -95,6 +95,7 @@ struct tc_prio_qopt { int bands; __u8 priomap[TC_PRIO_MAX+1]; + __u8 enable_flow; }; struct tc_multiq_qopt { |