Commit d5b7420a authored by Stephen Hemminger's avatar Stephen Hemminger

Remove #ifdef's

The iproute package keeps its own headers so there is no need
of polluting code with #ifdef's
parent a1e191b9
...@@ -278,12 +278,10 @@ int print_linkinfo(const struct sockaddr_nl *who, ...@@ -278,12 +278,10 @@ int print_linkinfo(const struct sockaddr_nl *who,
fprintf(fp, "mtu %u ", *(int*)RTA_DATA(tb[IFLA_MTU])); fprintf(fp, "mtu %u ", *(int*)RTA_DATA(tb[IFLA_MTU]));
if (tb[IFLA_QDISC]) if (tb[IFLA_QDISC])
fprintf(fp, "qdisc %s ", (char*)RTA_DATA(tb[IFLA_QDISC])); fprintf(fp, "qdisc %s ", (char*)RTA_DATA(tb[IFLA_QDISC]));
#ifdef IFLA_MASTER
if (tb[IFLA_MASTER]) { if (tb[IFLA_MASTER]) {
SPRINT_BUF(b1); SPRINT_BUF(b1);
fprintf(fp, "master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1)); fprintf(fp, "master %s ", ll_idx_n2a(*(int*)RTA_DATA(tb[IFLA_MASTER]), b1));
} }
#endif
if (tb[IFLA_OPERSTATE]) if (tb[IFLA_OPERSTATE])
print_operstate(fp, *(__u8 *)RTA_DATA(tb[IFLA_OPERSTATE])); print_operstate(fp, *(__u8 *)RTA_DATA(tb[IFLA_OPERSTATE]));
......
...@@ -364,7 +364,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, ...@@ -364,7 +364,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
if (len < 0) if (len < 0)
return -1; return -1;
addattr_nest_end(&req->n, vflist); addattr_nest_end(&req->n, vflist);
#ifdef IFLA_MASTER
} else if (matches(*argv, "master") == 0) { } else if (matches(*argv, "master") == 0) {
int ifindex; int ifindex;
NEXT_ARG(); NEXT_ARG();
...@@ -377,8 +376,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, ...@@ -377,8 +376,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
int ifindex = 0; int ifindex = 0;
addattr_l(&req->n, sizeof(*req), IFLA_MASTER, addattr_l(&req->n, sizeof(*req), IFLA_MASTER,
&ifindex, 4); &ifindex, 4);
#endif
#ifdef IFF_DYNAMIC
} else if (matches(*argv, "dynamic") == 0) { } else if (matches(*argv, "dynamic") == 0) {
NEXT_ARG(); NEXT_ARG();
req->i.ifi_change |= IFF_DYNAMIC; req->i.ifi_change |= IFF_DYNAMIC;
...@@ -388,7 +385,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, ...@@ -388,7 +385,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
req->i.ifi_flags &= ~IFF_DYNAMIC; req->i.ifi_flags &= ~IFF_DYNAMIC;
} else } else
return on_off("dynamic"); return on_off("dynamic");
#endif
} else if (matches(*argv, "type") == 0) { } else if (matches(*argv, "type") == 0) {
NEXT_ARG(); NEXT_ARG();
*type = *argv; *type = *argv;
...@@ -829,7 +825,6 @@ static int do_set(int argc, char **argv) ...@@ -829,7 +825,6 @@ static int do_set(int argc, char **argv)
flags |= IFF_NOARP; flags |= IFF_NOARP;
} else } else
return on_off("noarp"); return on_off("noarp");
#ifdef IFF_DYNAMIC
} else if (matches(*argv, "dynamic") == 0) { } else if (matches(*argv, "dynamic") == 0) {
NEXT_ARG(); NEXT_ARG();
mask |= IFF_DYNAMIC; mask |= IFF_DYNAMIC;
...@@ -839,7 +834,6 @@ static int do_set(int argc, char **argv) ...@@ -839,7 +834,6 @@ static int do_set(int argc, char **argv)
flags &= ~IFF_DYNAMIC; flags &= ~IFF_DYNAMIC;
} else } else
return on_off("dynamic"); return on_off("dynamic");
#endif
} else { } else {
if (strcmp(*argv, "dev") == 0) { if (strcmp(*argv, "dev") == 0) {
NEXT_ARG(); NEXT_ARG();
......
...@@ -277,12 +277,10 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) ...@@ -277,12 +277,10 @@ int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
ci->ndm_confirmed/hz, ci->ndm_updated/hz); ci->ndm_confirmed/hz, ci->ndm_updated/hz);
} }
#ifdef NDA_PROBES
if (tb[NDA_PROBES] && show_stats) { if (tb[NDA_PROBES] && show_stats) {
__u32 p = *(__u32 *) RTA_DATA(tb[NDA_PROBES]); __u32 p = *(__u32 *) RTA_DATA(tb[NDA_PROBES]);
fprintf(fp, " probes %u", p); fprintf(fp, " probes %u", p);
} }
#endif
if (r->ndm_state) { if (r->ndm_state) {
int nud = r->ndm_state; int nud = r->ndm_state;
......
...@@ -478,12 +478,11 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) ...@@ -478,12 +478,11 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (ci->rta_lastuse != 0) if (ci->rta_lastuse != 0)
fprintf(fp, " age %dsec", ci->rta_lastuse/hz); fprintf(fp, " age %dsec", ci->rta_lastuse/hz);
} }
#ifdef RTNETLINK_HAVE_PEERINFO
if (ci->rta_id) if (ci->rta_id)
fprintf(fp, " ipid 0x%04x", ci->rta_id); fprintf(fp, " ipid 0x%04x", ci->rta_id);
if (ci->rta_ts || ci->rta_tsage) if (ci->rta_ts || ci->rta_tsage)
fprintf(fp, " ts 0x%x tsage %dsec", ci->rta_ts, ci->rta_tsage); fprintf(fp, " ts 0x%x tsage %dsec",
#endif ci->rta_ts, ci->rta_tsage);
} }
} else if (r->rtm_family == AF_INET6) { } else if (r->rtm_family == AF_INET6) {
struct rta_cacheinfo *ci = NULL; struct rta_cacheinfo *ci = NULL;
...@@ -792,7 +791,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv) ...@@ -792,7 +791,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
if (get_unsigned(&mtu, *argv, 0)) if (get_unsigned(&mtu, *argv, 0))
invarg("\"mtu\" value is invalid\n", *argv); invarg("\"mtu\" value is invalid\n", *argv);
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
#ifdef RTAX_HOPLIMIT
} else if (strcmp(*argv, "hoplimit") == 0) { } else if (strcmp(*argv, "hoplimit") == 0) {
unsigned hoplimit; unsigned hoplimit;
NEXT_ARG(); NEXT_ARG();
...@@ -803,8 +801,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv) ...@@ -803,8 +801,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
if (get_unsigned(&hoplimit, *argv, 0)) if (get_unsigned(&hoplimit, *argv, 0))
invarg("\"hoplimit\" value is invalid\n", *argv); invarg("\"hoplimit\" value is invalid\n", *argv);
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplimit); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplimit);
#endif
#ifdef RTAX_ADVMSS
} else if (strcmp(*argv, "advmss") == 0) { } else if (strcmp(*argv, "advmss") == 0) {
unsigned mss; unsigned mss;
NEXT_ARG(); NEXT_ARG();
...@@ -815,8 +811,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv) ...@@ -815,8 +811,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
if (get_unsigned(&mss, *argv, 0)) if (get_unsigned(&mss, *argv, 0))
invarg("\"mss\" value is invalid\n", *argv); invarg("\"mss\" value is invalid\n", *argv);
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_ADVMSS, mss); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_ADVMSS, mss);
#endif
#ifdef RTAX_REORDERING
} else if (matches(*argv, "reordering") == 0) { } else if (matches(*argv, "reordering") == 0) {
unsigned reord; unsigned reord;
NEXT_ARG(); NEXT_ARG();
...@@ -827,7 +821,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv) ...@@ -827,7 +821,6 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
if (get_unsigned(&reord, *argv, 0)) if (get_unsigned(&reord, *argv, 0))
invarg("\"reordering\" value is invalid\n", *argv); invarg("\"reordering\" value is invalid\n", *argv);
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_REORDERING, reord); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_REORDERING, reord);
#endif
} else if (strcmp(*argv, "rtt") == 0) { } else if (strcmp(*argv, "rtt") == 0) {
unsigned rtt; unsigned rtt;
NEXT_ARG(); NEXT_ARG();
......
...@@ -36,19 +36,13 @@ static struct { ...@@ -36,19 +36,13 @@ static struct {
} llproto_names[] = { } llproto_names[] = {
__PF(LOOP,loop) __PF(LOOP,loop)
__PF(PUP,pup) __PF(PUP,pup)
#ifdef ETH_P_PUPAT
__PF(PUPAT,pupat) __PF(PUPAT,pupat)
#endif
__PF(IP,ip) __PF(IP,ip)
__PF(X25,x25) __PF(X25,x25)
__PF(ARP,arp) __PF(ARP,arp)
__PF(BPQ,bpq) __PF(BPQ,bpq)
#ifdef ETH_P_IEEEPUP
__PF(IEEEPUP,ieeepup) __PF(IEEEPUP,ieeepup)
#endif
#ifdef ETH_P_IEEEPUPAT
__PF(IEEEPUPAT,ieeepupat) __PF(IEEEPUPAT,ieeepupat)
#endif
__PF(DEC,dec) __PF(DEC,dec)
__PF(DNA_DL,dna_dl) __PF(DNA_DL,dna_dl)
__PF(DNA_RC,dna_rc) __PF(DNA_RC,dna_rc)
...@@ -62,19 +56,10 @@ __PF(ATALK,atalk) ...@@ -62,19 +56,10 @@ __PF(ATALK,atalk)
__PF(AARP,aarp) __PF(AARP,aarp)
__PF(IPX,ipx) __PF(IPX,ipx)
__PF(IPV6,ipv6) __PF(IPV6,ipv6)
#ifdef ETH_P_PPP_DISC
__PF(PPP_DISC,ppp_disc) __PF(PPP_DISC,ppp_disc)
#endif
#ifdef ETH_P_PPP_SES
__PF(PPP_SES,ppp_ses) __PF(PPP_SES,ppp_ses)
#endif
#ifdef ETH_P_ATMMPOA
__PF(ATMMPOA,atmmpoa) __PF(ATMMPOA,atmmpoa)
#endif
#ifdef ETH_P_ATMFATE
__PF(ATMFATE,atmfate) __PF(ATMFATE,atmfate)
#endif
__PF(802_3,802_3) __PF(802_3,802_3)
__PF(AX25,ax25) __PF(AX25,ax25)
__PF(ALL,all) __PF(ALL,all)
...@@ -90,9 +75,7 @@ __PF(TR_802_2,tr_802_2) ...@@ -90,9 +75,7 @@ __PF(TR_802_2,tr_802_2)
__PF(MOBITEX,mobitex) __PF(MOBITEX,mobitex)
__PF(CONTROL,control) __PF(CONTROL,control)
__PF(IRDA,irda) __PF(IRDA,irda)
#ifdef ETH_P_ECONET
__PF(ECONET,econet) __PF(ECONET,econet)
#endif
__PF(TIPC,tipc) __PF(TIPC,tipc)
__PF(AOE,aoe) __PF(AOE,aoe)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment