ubuntu-users Digest, Vol 56, Issue 170
Jose Rodriguez
joheiker at gmail.com
Thu Apr 16 12:52:02 UTC 2009
------------------------------
>
> Message: 3
> Date: Thu, 16 Apr 2009 01:29:33 -0400
> From: Matthew Flaschen <matthew.flaschen at gatech.edu>
> Subject: Re: PC freeze while executing Iproute2
> To: "Ubuntu user technical support, not for general discussions"
> <ubuntu-users at lists.ubuntu.com>
> Message-ID: <49E6C23D.6060806 at gatech.edu>
> Content-Type: text/plain; charset=UTF-8
>
> Jose Rodriguez wrote:
> > I compiled it and everything was fine but when i use the commands in a
> shell
> > to activate the algorithm it seems like iproute2 accepts the commands and
> > parameters i give but then the computer freeze. I cant do anything in it.
> > The only thing that works is the led or light of the "caps lock" button.
> So
> > i have to turn it off and turn it on again. I suspect it's a bad use or
> > memory or something like that. Im asking for some guidance here!!!!!
> Where
> > should i start looking for the problem?? What type of commmand might i
> have
> > used incorrectly??
>
> This (debugging private non-standard additions to the kernel) is way
> outside the scope of this list. Also, I don't know how you expect
> anyone to seriously help you without the source of your module/patch.
>
> Matt Flaschen
> ------------------------------
>
I know this kind of things is not what is this list is made of, but you
never know who can help you man. Maybe one of the readers is a genius or an
expert in linux kernel but also knows a lot about Ubuntu, hehe! But you
helped me somehow, i think i know where to start looking for some answer.
Thnxs!
And for the curious eyes here is the source of what i did and it's giving me
headaches:
(Remeber: this code is made for working in iproute2)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include "utils.h"
#include "tc_util.h"
static void explain(void)
{
fprintf(stderr, "Usage: ... pi qmax PKTS qref PKTS a VALUE b VALUE\n");
}
#define usage() return(-1)
static int pi_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct
nlmsghdr *n)
{
int ok=0;
struct tc_pi_qopt opt;
int ecn_ok = 0;
__u8 sbuf[256];
struct rtattr *tail;
memset(&opt, 0, sizeof(opt));
while (argc > 0) {
if (strcmp(*argv, "qmax") == 0) {
NEXT_ARG();
if (get_size(&opt.qmax, *argv)) {
fprintf(stderr, "Illegal \"qmax\"\n");
return -1;
}
ok++;
} else if (strcmp(*argv, "qref") == 0) {
NEXT_ARG();
if (get_size(&opt.qref, *argv)) {
fprintf(stderr, "Illegal \"qref\"\n");
return -1;
}
ok++;
} else if (strcmp(*argv, "a") == 0) {
NEXT_ARG();
if (get_size(&opt.a, *argv)) {
fprintf(stderr, "Illegal \"a\"\n");
return -1;
}
ok++;
} else if (strcmp(*argv, "b") == 0) {
NEXT_ARG();
if (get_size(&opt.b, *argv)) {
fprintf(stderr, "Illegal \"b\"\n");
return -1;
}
ok++;
} else if (strcmp(*argv, "ecn") == 0) {
ecn_ok = 1;
ok++;
} else if (strcmp(*argv, "help") == 0) {
explain();
return -1;
} else {
fprintf(stderr, "What is \"%s\"?\n", *argv);
explain();
return -1;
}
argc--; argv++;
}
if (!ok)
return 0;
if (!opt.qmax || !opt.qref || !opt.a || !opt.b) {
fprintf(stderr, "Required parameter (qmax, qref, a, b) is
missing\n");
return -1;
}
if (ecn_ok) {
#ifdef TC_RED_ECN
opt.flags |= TC_PI_ECN;
#else
fprintf(stderr, "PI: ECN support is missing in this binary.\n");
return -1;
#endif
}
tail = NLMSG_TAIL(n);
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
addattr_l(n, 1024, TCA_PI_PARMS, &opt, sizeof(opt));
addattr_l(n, 1024, TCA_PI_STAB, sbuf, 256);
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
return 0;
}
static int pi_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
struct rtattr *tb[TCA_PI_STAB+1];
struct tc_pi_qopt *qopt;
SPRINT_BUF(b1);
SPRINT_BUF(b2);
SPRINT_BUF(b3);
SPRINT_BUF(b4);
if (opt == NULL)
return 0;
parse_rtattr_nested(tb, TCA_PI_STAB, opt);
if (tb[TCA_PI_PARMS] == NULL)
return -1;
qopt = RTA_DATA(tb[TCA_PI_PARMS]);
if (RTA_PAYLOAD(tb[TCA_PI_PARMS]) < sizeof(*qopt))
return -1;
fprintf(f, "qref %s qmax %s a %s b %s ",
sprint_size(qopt->qref, b1),
sprint_size(qopt->qmax, b2),
sprint_size(qopt->a, b3),
sprint_size(qopt->b, b4));
#ifdef TC_PI_ECN
if (qopt->flags & TC_PI_ECN)
fprintf(f, "ecn ");
#endif
return 0;
}
static int pi_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr
*xstats)
{
#ifdef TC_RED_ECN
struct tc_pi_xstats *st;
if (xstats == NULL)
return 0;
if (RTA_PAYLOAD(xstats) < sizeof(*st))
return -1;
st = RTA_DATA(xstats);
fprintf(f, " marked %u early %u pdrop %u other %u",
st->marked, st->early, st->pdrop, st->other);
return 0;
#endif
return 0;
}
struct qdisc_util pi_qdisc_util = {
.id = "pi",
.parse_qopt = pi_parse_opt,
.print_qopt = pi_print_opt,
.print_xstats = pi_print_xstats,
};
--
A day without sunshine is like, you know...night.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090417/da99f7f2/attachment.html>
More information about the ubuntu-users
mailing list