]> git.pld-linux.org Git - packages/iproute2.git/blob - iproute2-latest.patch
- massive attack s/pld.org.pl/pld-linux.org/
[packages/iproute2.git] / iproute2-latest.patch
1 diff -urN iproute2.old/ip/ipaddress.c iproute2/ip/ipaddress.c
2 --- iproute2.old/ip/ipaddress.c Sun Sep 10 21:03:26 2000
3 +++ iproute2/ip/ipaddress.c     Thu Aug 23 06:07:46 2001
4 @@ -719,6 +719,15 @@
5         filter.oneline = oneline;
6  }
7  
8 +int default_scope(inet_prefix *lcl)
9 +{
10 +       if (lcl->family == AF_INET) {
11 +               if (lcl->bytelen >= 1 && *(__u8*)&lcl->data == 127)
12 +                       return RT_SCOPE_HOST;
13 +       }
14 +       return 0;
15 +}
16 +
17  int ipaddr_modify(int cmd, int argc, char **argv)
18  {
19         struct rtnl_handle rth;
20 @@ -735,6 +744,7 @@
21         int peer_len = 0;
22         int brd_len = 0;
23         int any_len = 0;
24 +       int scoped = 0;
25  
26         memset(&req, 0, sizeof(req));
27  
28 @@ -789,6 +799,7 @@
29                         if (rtnl_rtscope_a2n(&scope, *argv))
30                                 invarg(*argv, "invalid scope value.");
31                         req.ifa.ifa_scope = scope;
32 +                       scoped = 1;
33                 } else if (strcmp(*argv, "dev") == 0) {
34                         NEXT_ARG();
35                         d = *argv;
36 @@ -847,6 +858,8 @@
37                         brd_len = brd.bytelen;
38                 }
39         }
40 +       if (!scoped && cmd != RTM_DELADDR)
41 +               req.ifa.ifa_scope = default_scope(&lcl);
42  
43         if (rtnl_open(&rth, 0) < 0)
44                 exit(1);
45 diff -urN iproute2.old/ip/ipmaddr.c iproute2/ip/ipmaddr.c
46 --- iproute2.old/ip/ipmaddr.c   Sun Apr 16 19:42:51 2000
47 +++ iproute2/ip/ipmaddr.c       Mon Dec 24 23:33:02 2001
48 @@ -191,7 +191,7 @@
49  
50  static void print_maddr(FILE *fp, struct ma_info *list)
51  {
52 -       fprintf(fp, "%s\t", _SL_);
53 +       fprintf(fp, "\t");
54  
55         if (list->addr.family == AF_PACKET) {
56                 SPRINT_BUF(b1);
57 @@ -230,7 +230,8 @@
58  
59         for (; list; list = list->next) {
60                 if (oneline) {
61 -                       fprintf(fp, "%d:\t%s", cur_index, list->name);
62 +                       cur_index = list->index;
63 +                       fprintf(fp, "%d:\t%s%s", cur_index, list->name, _SL_);
64                 } else if (cur_index != list->index) {
65                         cur_index = list->index;
66                         fprintf(fp, "%d:\t%s\n", cur_index, list->name);
67 diff -urN iproute2.old/ip/ipmroute.c iproute2/ip/ipmroute.c
68 --- iproute2.old/ip/ipmroute.c  Sun Apr 16 19:42:51 2000
69 +++ iproute2/ip/ipmroute.c      Mon Dec 24 22:38:55 2001
70 @@ -108,9 +108,9 @@
71                 if (filter.msrc.family && inet_addr_match(&msrc, &filter.msrc, filter.msrc.bitlen))
72                         continue;
73  
74 -               format_host(AF_INET, 4, &msrc.data[0], sbuf, sizeof(sbuf));
75 -               format_host(AF_INET, 4, &maddr.data[0], mbuf, sizeof(mbuf));
76 -               snprintf(obuf, sizeof(obuf), "(%s, %s)", sbuf, mbuf);
77 +               snprintf(obuf, sizeof(obuf), "(%s, %s)", 
78 +                        format_host(AF_INET, 4, &msrc.data[0], sbuf, sizeof(sbuf)),
79 +                        format_host(AF_INET, 4, &maddr.data[0], mbuf, sizeof(mbuf)));
80  
81                 fprintf(ofp, "%-32s Iif: ", obuf);
82  
83 @@ -162,7 +162,7 @@
84         while (argc > 0) {
85                 if (strcmp(*argv, "iif") == 0) {
86                         NEXT_ARG();
87 -                       strcpy(filter_dev, *argv);
88 +                       strncpy(filter_dev, *argv, sizeof(filter_dev)-1);
89                 } else if (matches(*argv, "from") == 0) {
90                         NEXT_ARG();
91                         get_prefix(&filter.msrc, *argv, AF_INET);
92 diff -urN iproute2.old/ip/iproute.c iproute2/ip/iproute.c
93 --- iproute2.old/ip/iproute.c   Thu Aug  2 06:32:09 2001
94 +++ iproute2/ip/iproute.c       Thu Jan 10 03:12:16 2002
95 @@ -617,8 +618,8 @@
96                         fprintf(stderr, "Error: unexpected end of line after \"nexthop\"\n");
97                         exit(-1);
98                 }
99 +               memset(rtnh, 0, sizeof(*rtnh));
100                 rtnh->rtnh_len = sizeof(*rtnh);
101 -               rtnh->rtnh_ifindex = 0;
102                 rta->rta_len += rtnh->rtnh_len;
103                 parse_one_nh(rta, rtnh, &argc, &argv);
104                 rtnh = RTNH_NEXT(rtnh);
105 diff -urN iproute2.old/ip/iptunnel.c iproute2/ip/iptunnel.c
106 --- iproute2.old/ip/iptunnel.c  Sun Apr 16 19:42:51 2000
107 +++ iproute2/ip/iptunnel.c      Mon Dec 24 22:29:41 2001
108 @@ -399,31 +399,36 @@
109  
110  void print_tunnel(struct ip_tunnel_parm *p)
111  {
112 -       char s1[256];
113 -       char s2[256];
114 +       char s1[1024];
115 +       char s2[1024];
116         char s3[64];
117         char s4[64];
118  
119 -       format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1));
120 -       format_host(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2));
121         inet_ntop(AF_INET, &p->i_key, s3, sizeof(s3));
122         inet_ntop(AF_INET, &p->o_key, s4, sizeof(s4));
123  
124 +       /* Do not use format_host() for local addr,
125 +        * symbolic name will not be useful.
126 +        */
127         printf("%s: %s/ip  remote %s  local %s ",
128                p->name,
129                p->iph.protocol == IPPROTO_IPIP ? "ip" :
130                (p->iph.protocol == IPPROTO_GRE ? "gre" :
131                 (p->iph.protocol == IPPROTO_IPV6 ? "ipv6" : "unknown")),
132 -              p->iph.daddr ? s1 : "any", p->iph.saddr ? s2 : "any");
133 +              p->iph.daddr ? format_host(AF_INET, 4, &p->iph.daddr, s1, sizeof(s1))  : "any",
134 +              p->iph.saddr ? rt_addr_n2a(AF_INET, 4, &p->iph.saddr, s2, sizeof(s2)) : "any");
135 +
136         if (p->link) {
137                 char *n = do_ioctl_get_ifname(p->link);
138                 if (n)
139                         printf(" dev %s ", n);
140         }
141 +
142         if (p->iph.ttl)
143                 printf(" ttl %d ", p->iph.ttl);
144         else
145                 printf(" ttl inherit ");
146 +       
147         if (p->iph.tos) {
148                 SPRINT_BUF(b1);
149                 printf(" tos");
150 @@ -433,6 +438,7 @@
151                         printf("%c%s ", p->iph.tos&1 ? '/' : ' ',
152                                rtnl_dsfield_n2a(p->iph.tos&~1, b1, sizeof(b1)));
153         }
154 +
155         if (!(p->iph.frag_off&htons(IP_DF)))
156                 printf(" nopmtudisc");
157  
158 diff -urN iproute2.old/lib/libnetlink.c iproute2/lib/libnetlink.c
159 --- iproute2.old/lib/libnetlink.c       Fri Aug  3 00:43:41 2001
160 +++ iproute2/lib/libnetlink.c   Fri Aug 24 21:32:05 2001
161 @@ -241,6 +241,7 @@
162         iov.iov_base = buf;
163  
164         while (1) {
165 +               iov.iov_len = sizeof(buf);
166                 status = recvmsg(rtnl->fd, &msg, 0);
167  
168                 if (status < 0) {
169 diff -urN iproute2.old/lib/utils.c iproute2/lib/utils.c
170 --- iproute2.old/lib/utils.c    Thu Aug  2 05:32:44 2001
171 +++ iproute2/lib/utils.c        Thu Jan 10 03:33:53 2002
172 @@ -193,7 +193,9 @@
173  
174         memset(dst, 0, sizeof(*dst));
175  
176 -       if (strcmp(arg, "default") == 0 || strcmp(arg, "any") == 0) {
177 +       if (strcmp(arg, "default") == 0 ||
178 +           strcmp(arg, "any") == 0 ||
179 +           strcmp(arg, "all") == 0) {
180                 if (family == AF_DECnet)
181                         return -1;
182                 dst->family = family;
183 @@ -332,8 +334,21 @@
184  
185  int __get_hz(void)
186  {
187 +       char name[1024];
188         int hz = 0;
189 -       FILE *fp = fopen("/proc/net/psched", "r");
190 +       FILE *fp;
191 +
192 +       if (getenv("HZ"))
193 +               return atoi(getenv("HZ")) ? : HZ;
194 +
195 +       if (getenv("PROC_NET_PSCHED")) {
196 +               snprintf(name, sizeof(name)-1, "%s", getenv("PROC_NET_PSCHED"));
197 +       } else if (getenv("PROC_ROOT")) { 
198 +               snprintf(name, sizeof(name)-1, "%s/net/psched", getenv("PROC_ROOT"));
199 +       } else {
200 +               strcpy(name, "/proc/net/psched");
201 +       }
202 +       fp = fopen(name, "r");
203  
204         if (fp) {
205                 unsigned nom, denom;
206
This page took 0.038095 seconds and 3 git commands to generate.